I have the following om component

(defn world-view [data owner opts]
  (reify
    om/IInitState
      (init-state [_]
        (om/transact! data [:world] (fn [] [])))

    om/IWillMount
      (will-mount [_]
        (log (count (:world data))))

    om/IRender
      (render [_]
        (apply dom/table nil
          (om/build-all row (:world data))))))

I can log the count of the world property like above and it works as above.

But if I change IWillMount to the following:

    om/IWillMount
      (will-mount [_]
        (go (while true
              (log (:world data))
              (let [world (<! (get-world data (:dimensions opts)))]
                (om/! data #(assoc % :world world)))
              (<! (timeout (:poll-interval opts))))))

The (log (:world data)) expression raises this error:

Uncaught Error: Cannot manipulate cursor outside of render phase, only 
om.core/transact!, om.core/update!, and cljs.core/deref operations allowed 

This is confusing to me because I can't see how I am manipulating the cursor.

Can anyone explain why this would happen?

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

Reply via email to