> 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.

I agree that it should be able to. However it is not doing so.
In the component where I am calling make-animations, the cursor is
(:circles cursor) of the parent component, so my call in render-state was
exactly this:
(make-animations cursor)
The error that this throws indicates I'm trying to invoke make-animations
on an actual cursor object. If I change that to
(make-animations (om/value cursor))
it behaves as hoped.

Once again, I don't need or want to set local state from app state. That
was just something I tried when this more straightforward approach failed.


On Wed, Sep 3, 2014 at 4:51 PM, Daniel Kersten <[email protected]> wrote:

> 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" <[email protected]> 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 <[email protected]> wrote:
>>
>> Ahhhhhh thanks!
>> 2014/9/3 上午11:48 於 "David Nolen" <[email protected]> 寫道:
>>
>>> It is not. Use om.core/value
>>>
>>> On Wed, Sep 3, 2014 at 2:29 PM, Alan Shaw <[email protected]> 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 [email protected].
>>> > To post to this group, send email to [email protected].
>>> > 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> 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 [email protected].
> To post to this group, send email to [email protected].
> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to