Here is an example that works and uses a let. I wonder if the reaction inside the let is making it work...
(defn- render-one [state-key render-key db] (let [id (-> [:add-patient/tree-state state-key] subscribe deref :selected-ids first reaction)] (reaction @(subscribe [render-key @id])))) On Friday, 3 April 2015 20:53:57 UTC+1, Colin Yates wrote: > My insanity must be worse than I thought because I could swear it was > working earlier! > > On 3 April 2015 at 20:45, AndyR <andre.r...@gmail.com> wrote: > > reaction is a macro that expands to evaluating the passed forms (here: 'v') > > within a function (make-reaction). > > I don't know the internals of Reagent but my guess is that Reagent has to > > figure out which ratoms were used in that function call. This is done > > somehow (by maybe some context setting etc) but it's not too important to > > know. > > > > What matters is: In your case the v is evaluated before (by the "let") so > > nothing is noticed by (reaction). > > > > On Friday, April 3, 2015 at 3:21:02 PM UTC-4, Colin Yates wrote: > >> I know I am going insane: > >> > >> (register-sub > >> :add-patient/selected-journey-details-field > >> (fn [db] > >> (reaction (-> [:add-patient/local] > >> subscribe > >> deref :selected-journey-details-field)) > >> > >> #_(let [v (-> [:add-patient/local] > >> subscribe > >> deref :selected-journey-details-field)] > >> (reaction v)))) > >> > >> works but > >> > >> (register-sub > >> :add-patient/selected-journey-details-field > >> (fn [db] > >> #_(reaction (-> [:add-patient/local] > >> subscribe > >> deref :selected-journey-details-field)) > >> > >> (let [v (-> [:add-patient/local] > >> subscribe > >> deref :selected-journey-details-field)] > >> (reaction v)))) > >> > >> doesn't. And by 'not working' I mean the component doesn't notice any > >> changes to a subscription to :add-patient/selected-journey-details-field. > >> > >> After 4 hours banging my head I reduced it to the above, literally > >> commenting one and uncommenting the other (with a browser refresh > >> in-between). > >> > >> Any suggestions? > > > > -- > > Note that posts from new members are moderated - please be patient with > > your first post. > > --- > > You received this message because you are subscribed to the Google Groups > > "ClojureScript" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to clojurescript+unsubscr...@googlegroups.com. > > To post to this group, send email to clojurescript@googlegroups.com. > > Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.