Yes this has caught me out more than a few times. The problem is on my laptop I only have one screen so my lein process is generally hidden. It took a while to get into the habit of checking it for warnings first thing when something strange occurred.
<div>-------- Original message --------</div><div>From: Colin Yates <[email protected]> </div><div>Date:30/10/2014 5:24 PM (GMT+00:00) </div><div>To: [email protected] </div><div>Subject: [ClojureScript] Re: (newbie) om (0.8.0a1) cannot access cursor if passed through a component </div><div> </div>No, it does indeed show a warning about an undeclared Var. On Thursday, 30 October 2014 17:17:36 UTC, Jonas Enlund wrote: > You should see a warning when you compile the cljs source to js. Was this not > the case? > > On Thursday, October 30, 2014 7:14:50 PM UTC+2, Colin Yates wrote: > > Yeah, I really wasn't kidding about that newbie warning :). Data isn't > > defined anywhere. Doh. > > > > Everything is a lesson and this lesson is that you can reference undefined > > vars (or more accurately self-defining vars I guess). Long live JavaScript > > :). > > > > On Thursday, 30 October 2014 17:04:29 UTC, Jonas Enlund wrote: > > > On Thursday, October 30, 2014 6:57:43 PM UTC+2, Colin Yates wrote: > > > > (newbie warning!) > > > > I have a component which takes the app-state and renders it beautifully > > > > (for example a table of contacts) - great. > > > > > > > > [code] > > > > (defn mount-om [] > > > > (om/root > > > > original-component > > > > app-state > > > > {:target (. js/document (getElementById "my-app"))})) > > > > [/code] > > > > > > > > Now I create a "wrapper" component of the form: > > > > > > > > [code] > > > > (defn wrapper [app owner] > > > > (reify > > > > om/IRender > > > > (render [_] > > > > (om/build original-component data)))) > > > > > > > > (defn mount-om [] > > > > (om/root > > > > wrapper > > > > app-state > > > > {:target (. js/document (getElementById "my-app"))})) > > > > [/code] > > > > > > > > And I can see the table my original component produces but it is empty. > > > > original-component is treating its data as a map so it is simply > > > > (om/build-all (dom/li ...) (:contacts data)). > > > > > > > > I can create a trivially simple project on github if that isn't clear? > > > > > > > > I don't understand how simply wrapping it in a component can change the > > > > nature of the cursor that original-component sees? I have almost > > > > certainly missed something here :). > > > > > > Should (om/build original-component data) be (om/build original-component > > > app)? I can't see where `data` is defined. -- 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.
