David, can you give more details why? Is it because what it points to may
become invalid if the app-state changes?

I'd have to dig up code where I've actually done it, I can't think of any
offhand but I'm sure I have and haven't had any issues, but I can
understand why it might be a bad idea!

How do you deref the cursor during render phase? (om/value some-cursor) ?


On 3 September 2014 13:01, David Nolen <[email protected]> wrote:

> Putting cursors into state is not a good idea.
>
>
> On Wednesday, September 3, 2014, Daniel Kersten <[email protected]>
> wrote:
>
>>
>> On 3 Sep 2014 06:51, "Alan Shaw" <[email protected]> wrote:
>> >
>> > PS My confusion is increased by the fact that if I print out next-props
>> from within will-receive-props, it appears on the console to be a plain
>> vector, but in the next line of code, where I use it in om/set-state!, it
>> is in fact a cursor.
>>
>> Is this a problem? I often do (om/set-state! owner :foo some-cursor)
>>
>> Can you explain some more what problem you are encountering?
>>
>> >
>> >
>> > On Tue, Sep 2, 2014 at 10:45 PM, Alan Shaw <[email protected]> wrote:
>> >>
>> >> My main app cursor has a field :circles which is a vector. My animator
>> component's render-state method needs these circles transformed into
>> animations. This is done by a function make-animations. The parent
>> component invokes om/build on the animator, passing (:circles cursor) as
>> the animator's cursor.
>> >>
>> >> I find that whenever I try to invoke the function on :circles, it is a
>> cursor
>> >> and may not be dereferenced. This is true at all the places I have
>> tried it:
>> >> 1. in a :fn passed by the parent component as a member of the map in
>> om/build,
>> >> along with (:circles cursor).
>> >> 2. within the animator's render-state itself,
>> >> and
>> >> 3. in the animator's will-receive-props method. It is here that the
>> docs claim "This is a good place to detect app state changes and make
>> updates to local component state using om/set-state! or om/update-state!."
>> >>
>> >> My question is: how?
>> >>
>> >> Shanti,
>> >>
>> >> Alan
>> >
>> >
>> > --
>> > 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