Problems is a strong word, probably too strong.

It felt odd to store the data inline there, and it caused some issues with 
creating new items (which aren't in any list yet, but will be bucketed by the 
server upon creation).

Our server backend models lists very similarly (where the list is a list of 
ids, not the data itself) and the data can be fetched separately, keeping the 
client side representation of that data similar to the API has made the syncing 
process much simpler. Perhaps that is the trade off?

--Todd

On Thursday, October 2, 2014 1:50:59 PM UTC-7, Jamie Orchard-Hays wrote:
> Interesting problem. I've developed an Om component that allows the creating 
> and editing of recursive trees with various kinds of lists, but haven't had 
> the need to move a list or an item to a different one, so haven't tackled 
> this particular problem.
> 
> 
> 
> What were the issues caused with your first Atom when moving items between 
> lists?
> 
> 
> 
> Jamie
> 
> 
> 
> 
> 
> On Oct 2, 2014, at 4:39 PM, Todd Berman <[email protected]> wrote:
> 
> 
> 
> > I am in the middle of writing my first large OM/CLJS app, and have run into 
> > something that feels wrong, and I am curious if other people have come up 
> > with better solutions for it.
> 
> > 
> 
> > I am writing a CMS-type app that allows you to edit/create data objects 
> > that are stored in various lists. Originally, I was storing them in an atom 
> > like:
> 
> > 
> 
> > {:lists {
> 
> >  "list 1" [{ ... } { ... }]
> 
> > }}
> 
> > 
> 
> > However, that causes some issues when items moved from list to list, so 
> > instead I started storing them like:
> 
> > 
> 
> > {:lists {
> 
> >  "list 1" ["id1", "id2"]
> 
> >  }
> 
> >  :items {
> 
> >    "id1": { ... }
> 
> >    "id2": { ... }
> 
> > }}
> 
> > 
> 
> > This generally works, but feels a bit gross, because now om components that 
> > show the list of items must have a reference to their own data, but also 
> > the items themselves in order to generate cursors to pass to om/build.
> 
> > 
> 
> > As I got further into it, it has gotten a bit uglier (because I added a 
> > datatype that included a list of items of its own type), which is why I am 
> > asking if anyone has any better solutions to an issue like this?
> 
> > 
> 
> > I could expose the root atom in shared state, but that sounds just like a 
> > different bad idea.
> 
> > 
> 
> > Any thoughts?
> 
> > 
> 
> > --Todd
> 
> > 
> 
> > -- 
> 
> > 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