Fork me on GitHub
#reagent
<
2017-01-26
>
sivakumargsk03:01:29

@piotr2b thank you very much for spending your valuable time on that. i am ok with that.

branch1415:01:27

The following example might seem a bit contrived, but it results in a Warning: Every element in a seq should have a unique :key...

(def some-list
  '("here " [:a {:href "#"} "a link"] " and some text"))

(defn example []
  [:div
   (for [x (range 1 3)] ^{:key x}
     (into [:div] some-list))])
I have resolved the warning in other cases, but with this I'm stuck.

richiardiandrea15:01:23

Thanks @gadfly361 they are good names

pesterhazy16:01:46

@branch14, the metadata is misplaced

pesterhazy16:01:11

try using a regular prop instead

pesterhazy16:01:26

(into [:div {:keys x}] ...)

branch1416:01:27

@pesterhazy Thx. It works if I use :key instead of :keys. I didn't realize that it was complaining about the :div not having a key, since the error message was about the content of some-list. Confusing.

pesterhazy16:01:41

ah yes that was a typo

pesterhazy16:01:31

the metadata syntax is confusing and should be avoided IMO

richiardiandrea18:01:07

so my understanding of track is somewhat challenged

richiardiandrea18:01:28

I see basically the tracked function is called every time the atom it depends on is changed

richiardiandrea18:01:52

and I don't understand how/when the caching (if any) happens

richiardiandrea18:01:15

scratch the above, I just solved by using a cursor in my tracked functions

pesterhazy19:01:05

@richiardiandrea what's unclear about r/track's caching?

richiardiandrea19:01:26

no basically it does not cache on the input (and why it would)

richiardiandrea19:01:38

by input I mean a derefed atom

richiardiandrea19:01:57

you need a cursor that points to your data

richiardiandrea19:01:02

but that's solved now

richiardiandrea19:01:15

I was deref-ing the whole app-state

pesterhazy19:01:34

a cursor would only limit cache invalidations right?

richiardiandrea19:01:36

yes the caching is on the output of track though, this was the point I was missing, a bit spoiled from re-frame subscriptions 😄