Not sure I see the problem? The function you pass is supposed to return the result of (reify...). In terms of good design patterns I am suggesting that (defn animate..) no longer returns a factory but becomes instead a trivial decorator.
As it is now animate is returning a function rather than a reified instance and unless om is doing something clever (like automatically executing the function) that function, and not the result of executing that function is becoming part of the state. This might be a case of the blind leading however well sighted you are as I am a newbie on om as well :). Ultimately, have a look at https://github.com/swannodette/om/wiki/Basic-Tutorial and explain how it would be different from contact-views and contact-view. On Saturday, 8 November 2014 14:52:36 UTC, Paul Cowan wrote: > But then it is no longer a func that can be passed to om/build. > > The func will just get executed unless I misunderstood you? > > > > > Cheers > > Paul Cowan > > Cutting-Edge Solutions (Scotland) > > > blog: http://thesoftwaresimpleton.com/ > website: http://www.cuttingedgesolutionsscotland.com/ > > > On 8 November 2014 13:33, Colin Yates <[email protected]> wrote: > Might be a red-herring, but here goes: > > > > Is it because animate is returning an anonymous function which is a no-no (as > anonymous functions instances are not equal)? > > > > What happens if you remove the (fn [..]) from animate so animate is (defn > animate [...] (reify ...))? > > > > On Saturday, 8 November 2014 11:30:30 UTC, Paul Cowan wrote: > > > I am playing about with creating a wrapper component that I can add some > > simple animations to. I know there is ominate but this is just for my own > > tinkering. > > > > > > I am rendering a number of dynamic components from a list like this: > > > > > > (map #(om/build clip-view % {:key :id}) clips) > > > > > > When I render the list like this, it only ever renders the newest item but > > when I add the wrapper component like this: > > > > > > (map #(om/build (animate clip-view) % {:key :id}) clips) > > > > > > The entire list gets re-rendered each time. > > > > > > At the moment, there is no functionality in my wrapper component which > > looks like this: > > > > > > (defn animate [component & args] > > > (fn [props owner opts] > > > (reify > > > om/IRender > > > (render [_] > > > (om/build component props {:opts opts}))))) > > > > > > Why would adding the wrapper cause all items to be re-rendered? > > > > -- > > Note that posts from new members are moderated - please be patient with your > first post. > > --- > > You received this message because you are subscribed to a topic in the Google > Groups "ClojureScript" group. > > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/clojurescript/RUCEFqzwdqQ/unsubscribe. > > To unsubscribe from this group and all its topics, 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.
