This is not necessary.

On Fri, Jan 17, 2014 at 5:47 PM, Vijay Kiran <m...@vijaykiran.com> wrote:

> Shouldn't this :
>
>  (dom/h1 nil (:title data))
>
> be:
>
>   (apply dom/h1 nil (:title data))
>
> ./Vijay
>
> ------
> http://vijaykiran.com
>
> On Friday, January 17, 2014 11:28:54 PM UTC+1, Sam Aaron wrote:
> > Hi there,
> >
> >
> >
> > I was playing about with Om and ran into an issue when attempting to put
> a function call inside a prop. Here's a minimal app:
> >
> >
> >
> >
> >
> > (defn subdiv-color []
> >
> >   (rand-nth ["black" "green" "blue" "red"]))
> >
> >
> >
> > (def app-state (atom {:title "Testing Testing"
> >
> >                       :subdivs   ["subdiv1"
> >
> >                                   "subdiv2"]}))
> >
> >
> >
> > (defn render-subdiv [content]
> >
> >   (dom/div #js{:style #js{:color (subdiv-color)}} content))
> >
> >
> >
> > (defn main-div [data owner]
> >
> >   (om/component
> >
> >    (dom/div nil
> >
> >             (dom/h1 nil (:title data))
> >
> >             (apply dom/p nil
> >
> >                    (map render-subdiv (:subdivs data))))))
> >
> >
> >
> > (def r1 (om/root app-state main-div js/document.body))
> >
> >
> >
> > (js/setTimeout #(swap! app-state assoc
> >
> >                        :title "1 2 3...")
> >
> >                1000)
> >
> >
> >
> >
> >
> > On the first render, everything is hunky-dory. However, when the timeout
> function triggers swapping the state, the second render blows up with:
> >
> >
> >
> > Error while invoking `findComponentRoot` with the following ancestor
> node:
> >
> > <body>​…​</body>​
> >
> > react.js:8813
> >
> >
> >
> > Uncaught Error: Invariant Violation: findComponentRoot(...,
> .r[hn4d].[1].[0]): Unable to find element. This probably means the DOM was
> unexpectedly mutated (e.g. by the browser).
> >
> > react.js:13161
> >
> >
> >
> > Am I doing anything obviously wrong? If I replace the call to
> subdiv-color to "black" everything works great. However, I'd really like to
> be able to modify the props based on some logic.
> >
> >
> >
> > Sam
> >
> >
> >
> > ---
> >
> > http://sam.aaron.name
>
> --
> 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.
>

-- 
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.

Reply via email to