Fork me on GitHub

I have a list of sessions, which a getting updated by an re-frame handler, now I want to set an session as active by referencing it in a designated map. There should be additions to the map, which are doesn’t have to occur in the original map. But the referenced map should get all updates, which are happening in the sessions list.

 {1 {:id   1
     :name "Name1"}}
 {2 {:id   2
     :name "Name2"}}
 {:id              1
  :name            "Name1"
  :additional-info "Info"}}
How could I achive this with reactions?

Chris O’Donnell13:12:14

@danielgrosse: You could store idents rather than the actual data and update your subscriptions accordingly. For example, your active session there would just be {:id 1} and you'd have a function in your subscription that grabs the session with a particular id. Like (get-in db [:sessions id]).


Thanks @codonnell thats how I done it now.


At, the comment states ;; Notice the ugly "doall". What is the reason for the doall? In the code for v-box, the children are put (into [] children), so I would assume it will be fully evaluated at that point. Am I missing something?


How can I specify different keys for the react components? I get warnings for children with the same key. I use re-com for element generation.


@sashton I had to use doall, because react throws some errors when not.


yeah, i've seen that error before as well. but in the case of v-box, it looks to me like the children are being put into a vector internally anyway, so they would be fully evalueated


I had a v-box without it, and it works.


@sashton: I can't remember why we did that. If I was doing it now, I'd probably do this:

    :children (for [c ["red" "green" "blue"]]  ...


children does not have to be vector, just an ISeq


@mikethompson: thanks, that's what it looked like to me as well. glad to know i was understanding it