Hello, I'm trying to understand when we must deref a cursor to get its value.
In the om cursors wiki (https://github.com/omcljs/om/wiki/Cursors) it states that event handlers are considered not part of the render phase, and therefore cursors in handlers should be drefed. Same is shown in the Basic-tutorial (https://github.com/omcljs/om/wiki/Basic-Tutorial): (defn contact-view [contact owner] (reify om/IRenderState (render-state [this {:keys [delete]}] (dom/li nil (dom/span nil (display-name contact)) (dom/button #js {:onClick (fn [e] (put! delete @contact))} "Delete"))))) But, in the TodoMVC code (https://github.com/swannodette/todomvc/blob/gh-pages/labs/architecture-examples/om/src/todomvc/item.cljs), the handlers (onclick, onchange...) use the cursor without drefing it: (defn submit [e todo owner comm] (when-let [edit-text (om/get-state owner :edit-text)] (if-not (string/blank? (.trim edit-text)) (do (om/update! todo :title edit-text) (put! comm [:save todo])) (put! comm [:destroy todo]))) false) So, what is the correct way? Thank you. -- 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.
