I’m working on an Om application that includes a music browser and player with a simple artist -> albums -> songs hierarchy. When a user is viewing an artist section I layout all the artist’s albums and songs hierarchically and this works great since there is basically a 1-to-1 correspondence between the component hierarchy and the data hierarchy.
Here’s a basic example of what a piece of the application state might look like under some sort of :current-artist key: {:name “The Beatles” :albums [{:name “Abbey Road”, :songs [{:name “Come Together”} {:name “Something”}]} {:name "Rubber Soul", :songs [{:name "Drive My Car"} {:name "Norwegian Wood"}]}]} When a user plays one of these songs I build an ordered playlist of all the artist’s songs. There is a player component that plays the playlist (even if the user navigates away from the current artist section) and displays the currently playing artist, album and song name. To achieve this I ended up duplicating a bunch of artist/album/song data elsewhere in the application state. Here’s what the :playlist path of the application state might look like after a user clicked the play button next to “Drive My Car”: {:play-index 2 :songs [{:name “Come Together” :album {:name “Abbey Road” :artist {:name "The Beatles"}}} {:name “Something” :album {:name “Abbey Road” :artist {:name "The Beatles"}}} {:name “Drive My Car” :album {:name “Rubber Soul” :artist {:name "The Beatles"}}} {:name “Norwegian Wood” :album {:name "Rubber Soul" :artist {:name "The Beatles"}}}]} I think this sort of denormalization works fine in my case since the artist/album/song data is not changing but I'm wondering if there is a better way to accomplish this. If the data were changing then I would imagine it could become a challenge to keep the playlist data in sync. -- 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.