Minor correction: did-update should be (= prev-props data). It gets the "old" cursor value as it's argument. On 4 Sep 2014 00:50, "Daniel Kersten" <dkers...@gmail.com> wrote:
> I went digging and the code where I set local state to cursor data was > actually old code and I was missremembering it :-) > All of my new code does actually strictly separate the two mechanisms so > that app state refers to the domain data (the what) and local state refers > to the state of widgets (the how). So there actually isn't any natural > overlap. > > As for Alans question, I've reread it a few times and I'm not sure I > understand what you're trying to achieve. > > make-animations should be able to work with (:circles cursor) without > knowing or caring if it gets given a cursor or not - cursors are quite > transparent. > > Are you trying to detect if the cursor has changed from one update to the > next? > > If yes then you can compare your current cursor to the previous one in > will-receive-props by doing (when-not (= (om.core/get-props owner) > next-props) (cursor-has-changed)) or in did-update using (when-not (= > next-props data) (cursor-has-changed)) where data is your cursor. > Use the former if you want to do this before render and the latter if > after. Note that if you modify local state in did-update you will trigger > a rerender potentially causing a render loop (but if you only do this when > your cursor data has changed, it's not a problem because the second time > the conditional will be false). > > Hope that helps. > Alan, if you haven't read this page, it's very helpful: > > https://github.com/swannodette/om/wiki/Cursors > > Jamie > On Sep 3, 2014, at 3:21 PM, Alan Shaw <noden...@gmail.com> wrote: > > Ahhhhhh thanks! > 2014/9/3 上午11:48 於 "David Nolen" <dnolen.li...@gmail.com> 寫道: > >> It is not. Use om.core/value >> >> On Wed, Sep 3, 2014 at 2:29 PM, Alan Shaw <noden...@gmail.com> wrote: >> > So it is OK to take (.-value cursor) in render-state? >> > >> > -- >> > 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. >> > > -- > 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. > -- 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.