http://facebook.github.io/react/docs/component-api.html. Remember `owner` is a real React instance.
David On Mon, May 5, 2014 at 5:55 PM, Roman Scherer < [email protected]> wrote: > Hi David, > > thanks for the confirmation. Is there a way I can detect if the > component is mounted? I first tried adding a :mounted? flag to > component state and set/change it in will-mount and > will-unmount. But I get the same error when I call om/set-state! > in will-unmount. > > Roman > > On Monday, May 5, 2014 11:43:33 PM UTC+2, David Nolen wrote: > > Setting up go blocks in mount/unmount is fine in my opinion, but yes, > you must handle the concurrency issues that arise from doing this. > > > > > > David > > > > > > > > > > On Mon, May 5, 2014 at 5:32 PM, Roman Scherer < > [email protected]> wrote: > > > > Hi, > > > > > > > > I think I'm running into a race condition while using om and > > > > core.async. I have code like this: > > > > > > > > om/IWillMount > > > > (will-mount [this] > > > > (go (let [image (<! (load-image (om/get-state owner :url)))] > > > > (om/set-state! owner :width (:width image)) > > > > (om/set-state! owner :height (:height image))))) > > > > > > > > The load-image fn returns a channel. Then I do a blocking read on > > > > that channel and at some point later, it returns a map which I > > > > save to the component's local state. > > > > > > > > Mounting, unmounting and remounting works fine with one > > > > component. However, when I have more than one instances of this > > > > component and I remount them I get most of the time the following > > > > error. > > > > > > > > Uncaught Error: Invariant Violation: forceUpdate(...): Can > > > > only force an update on mounted or mounting components. > > > > > > > > This looks like the calls to om/set-state! within the go block > > > > are sometimes called when the component is already unmounted. > > > > > > > > Now I'm wondering if I'm doing something wrong and have some > > > > questions. > > > > > > > > * Is it bad style to use go blocks in the will-mount/did-mount fn > > > > and set state in them? > > > > > > > > * Do other people have similar issues, and how to work around? > > > > > > > > * Any other idea what's going on? > > > > > > > > Thanks, Roman. > > > > > > > > -- > > > > 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. > -- 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.
