This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-28
Channels
- # aatree (3)
- # alda (8)
- # avi (21)
- # beginners (37)
- # boot (193)
- # cbus (1)
- # cider (29)
- # cljs-dev (8)
- # cljsjs (3)
- # cljsrn (20)
- # clojure (76)
- # clojure-dev (13)
- # clojure-miami (20)
- # clojure-portugal (2)
- # clojure-russia (220)
- # clojure-sg (2)
- # clojurebridge (5)
- # clojurescript (94)
- # community-development (14)
- # conf-proposals (110)
- # core-async (12)
- # cursive (12)
- # datascript (6)
- # datomic (14)
- # dirac (72)
- # emacs (49)
- # hoplon (86)
- # jobs (33)
- # jobs-discuss (1)
- # ldnclj (6)
- # lein-figwheel (1)
- # off-topic (56)
- # om (139)
- # onyx (29)
- # pedestal (17)
- # proton (23)
- # re-frame (45)
- # reagent (35)
- # ring-swagger (4)
- # test-check (1)
- # testing (8)
- # yada (11)
@danielcompton I think I understand dynamic subscriptions, but why you're asking? My question earlier about when components update don't have anything to do with dynamic subscriptions, right?
oops, sorry, meant to mention @yenda for that
@yenda: do you understand dynamic subscriptions now, or is there something still unclear?
@danielcompton: I'm not sure. It didn't fit my use case, the way I understood it is that you had to have a subscription to the "current id" of the entity you want to dynamically track, and a second one that subscribe to it
I think the exemple in the wiki is not clear enough, is (q/get-query active-list) a function to get the active-list that is supposed to be defined elsewhere ?
I think I need to update that example to be clearer, you’re right
I wanted to use it because I have deeply nested datastructures with mixes of maps and lists that are edited in subcomponents
so at some point to "make things easier" I started to use refs and uuids in my datastructure and it started to look like a relationnal db
I'm not sure what the best solution is for that kind of things, I went back to nested datastructure but I have to pass some parents props to be able to edit fields
The most tricky thing was to modify the parameters of a request because it's a map so I didn't know how to change the name properly. my solution was to turn parameters into a vector in the editor and change it back into a map when saving. I also have to pass the request index to the parameter component to be able to send it in the event
actually it is silly, my afterthought is that it would be easier to just keep the parameter, dissoc the old name and assoc the new one when it changes
the problem when you edit a field that is defined by a key is that you lose focus of the component you are editing though
@danielcompton: If you don't mind. is it correct to say of a Form-2 component, 1. the inner render function is called again when an atom that was deref'd inside it, changed since the last call 2. the outer function is called again when the function argument values are different from last time
Why can't/shouldn't I just use (reaction (some-transformation @re-frame.db/app-db))
instead of subscriptions?
True, but you do it once at the boot of application, so during the run of application it's effectively immutable.
Yeah, but that's reason enough - better have a common place to have subscriptions in, instead of duplicating code.
like
(def users (reaction ...))
(def sorted-users (reaction (sort-by :join-date @users))
Maybe there was some reason to make subscriptions dynamic, thought I'm not sure what could that be; I don't really see any upsides to being able to register subscriptions dynamically.
The dynamic reloading that happens in the figwheel-like development process may be a reason.
If you just def them they are all there and will always be run if an input atom changes, regardless of whether they are needed anywhere.
That's all under "maybe" though, I don't understand it well enough to say with certainty.
Hmm, I don't think reactions are run automatically unless you create them by run!
instead of reaction
.
One more reason I can think of (apart from dynamicity; but then again it seems of little value, unless in development and then you have boot-reload/figwheel) is that you also have reactions with parameters