Fork me on GitHub
#reagent
<
2016-09-14
>
sonnyto04:09:16

given a cursor, is there a way to find its path?

sonnyto04:09:06

RCursor is a deftype with a path attribute

sonnyto04:09:23

(.-path a-cusor) works

artur07:09:05

Hello all! I first created project with "lein new reagent myproject" but now I want to remove all server side code and just use figwheel to serve index.html that is located under resources/public folder. I am facing a problem where starting lein figwheel gives me following error: Could not locate mtg_cards/core__init.class or mtg_cards/core.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name. java.io.FileNotFoundException: Could not locate mtg_cards/core__init.class or mtg_cards/core.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name. I have tried multiple times to re-configure my project.clj file and still no luck. I have pushed current code to branch https://github.com/mtg-cards/mtg-cards-client/tree/remove-server Can someone familiar with figwheel let me know what am I doing wrong?

reefersleep09:09:39

@artur: while I'm all for finding the source of errors and learning something in the process, I think that there are templates for frontend-only reagent projects.

reefersleep09:09:15

lein new reagent-frontend myproject

artur09:09:31

@reefersleep yes there is and I already did create a new project with that and tried to apply the settings, but am still facing problems.

reefersleep09:09:41

Well, that sucks 🙂

artur09:09:46

Perhaps I'll just try again

artur09:09:11

should've started with frontend only from the beginning 😄

reefersleep09:09:21

I've had similar problems several times, when I've been dependent on two different templates and wanted to merge them.

artur09:09:28

I've got an idea. I will create new frontend project and more the src folder to that and apply minor changes to env folder and project.clj :thumbsup:

reefersleep09:09:41

That's how I've done it previously. Godspeed!

eyelidlessness18:09:15

how do people deal with components which take an arbitrary number of children? i've been using (into [:whatever] children) but this seems ill advised

eyelidlessness18:09:30

i know typically when you want a sequence of children, you're supposed to use :key, but what if the component doesn't know enough about the children to provide a :key? is it sane to use something like ^{:key (hash child)}? is that going to perform badly?

juhoteperi18:09:33

:key is not needed when using (into [:whatever] children)

eyelidlessness18:09:00

right, i'm trying to move away from into, i believe it contributed to a bug i encountered

juhoteperi18:09:09

in these cases the number of children is used as key automatically

eyelidlessness18:09:53

or is into safe and i'm barking up the wrong tree?

juhoteperi18:09:48

Should be safe

juhoteperi18:09:24

Btw. https://github.com/reagent-project/reagent/issues/259 this bug is now part of stable release, please add thumbs up if you agree this is very important

juhoteperi19:09:16

In my opinion this is critical as it prevents building more complicated components using input or textarea elements

juhoteperi19:09:42

(0.6.0 was just released 10 minutes ago)

mccraigmccraig19:09:20

@eyelidlessness if your list of children is long and changes much into might be bad for performance, but should otherwise be fine - if you need keys you could maybe use a multimethod to extract a key value from the child data (so the knowledge of how to extract the key from different child types resides with the child type) ?

eyelidlessness19:09:04

@mccraigmccraig that's interesting. though i imagine a multimethod for that could be pretty complex

mccraigmccraig19:09:15

@eyelidlessness depends on the shape of your data i guess - in my app i don't even need a multimethod since data generally has :id keys

eyelidlessness19:09:03

the issue is where the children may be arbitrary.

eyelidlessness19:09:07

example, i have a form component that takes fields which may be nested in paragraphs, labels, and so on

eyelidlessness19:09:59

anyway i realized that the bug i ran into wasn't directly related to into, it was an into inside a conj, and it was very easy to fix that particular bug without broadly addressing into

eyelidlessness19:09:33

thanks for the help all

gamecubate19:09:46

btw I’m always wondering if I should repeat the function arguments into the inner one, as advised on https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components .

gamecubate19:09:43

Just reread and realized I didn’t need the inner function after all. Inners are only accompany preliminary (one-time) setup of the component.