> I cannot really comment further because I don't know what you are
> doing or why you doing it the way you are doing it. A simple
> illustrative example of your approach and a description of the
> perceived advantages of that approach would clear things up.

Well, it's quite simple: we pass an atom into root, and then we
sometimes receive updates from the server which directly modify this
atom.  For example, say I have

(def our-data (atom {:some {:path [{:id 1} {:id 2}]}}))

(root root-component our-data ...)

If I have a nested component that maps to :path, and then I receive an
update from outside of Om--path may have been a cursor initially, but
after I call

;; totally outside of Om:
(swap! our-data #(update-in % [:some :path] ...))

then path is no longer a cursor.

Similarly, if I want to process the cursor (vector) at :path before I
pass it into the component:

;; inside of a component's render/render-state call:
(group-by :id (get-in my-data [:some :path]))

...then I no longer seem to have a cursor.

> Without knowing more details it initially sounds like you are
> going against the flow with respect to how Om is intended to be used.

Perhaps we are going against the flow: our data flows in from outside
the app from the server via browserchannel/websockets, rather than
getting updated via transact!/update! and then flowing out, to the
server.  We have good reasons for this, and Om generally seems to work
well despite the fact that we are abusing it.  But I'd like to know if
this is not a model that Om can or will ever support--if it is possible
with Om, I'd like to know how we can do this "the Right Way."

Thanks--

DD

(2014/04/03 21:03), David Nolen wrote:
> On Thu, Apr 3, 2014 at 7:48 AM, Dave Della Costa <[email protected]
> <mailto:[email protected]>> wrote:
> 
>     Of course what happens whenever an update occurs from the outside is
>     that any cursors that were passed into components that are affected by
>     those updates get wiped out and replaced by basic Clojure data
>     structures.  Om components don't complain--of course, a lot of what
>     cursors are are wrappers around the base functionality in Clojure data
>     structures.  But there are problems whenever there are state updates in
>     those components affected.
> 
> 
> I don't really understand how cursors can get wiped out. Without knowing
> more details it initially sounds like you are going against the flow
> with respect to how Om is intended to be used.
>  
> 
>     Additionally, there are cases where we do a lot of data manipulation to
>     get cursor data into the right format for a child component--it's
>     neither possible nor desirable for us to format our data before loading
>     it into root.  But again this wipes out cursors in child components and
>     calls to set-state! and etc. will throw errors.
> 
> 
> Again not enough details to understand why you need to do so much
> transformation.
> 
> I cannot really comment further because I don't know what you are doing
> or why you doing it the way you are doing it. A simple illustrative
> example of your approach and a description of the perceived advantages
> of that approach would clear things up.
> 
> David
> 
> -- 
> 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]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[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