Hi, 

I have a problem to understand why the follwoing exmaple does not work. 


(def app-state (atom {:version "0.1.0"
                                  :project-id nil}))



; main widget
(defn app [app owner]
  (reify
    om/IRender
    (render [_]
      (html [:div.app-wrapper nil
                (om/build sidebar app)
                (om/build main app)]))))



(defn main [app-state owner]
  (reify
    om/IRender
    (render [_]
      (html [:div.main-wrapper nil
        (om/build entry-view app-state)]))))



(defmulti entry-view (fn [app-state _]
  (if (= (:project-id app-state) nil)
    :empty
    :exist)))

(defmethod entry-view :empty
  [app-state owner] (empty-view app-state owner))

(defmethod entry-view :exist
  [app-state owner] (project-view app-state owner))



(defn empty-view [app-state owner]
  (reify
    om/IWillMount 
    (will-mount [_]
      (prn "ok i will mount"))
    om/IRender
    (render [_]
      (html [:div nil
              [:h2 nil"Open an existing project"]]))))



(defn project-view [app-state owner]
  (reify
    om/IWillMount
    (will-mount [_]
      (prn "why not me ?"))
    om/IRender
    (render [_]
      (html [:div nil (str "project view: " (:project-id app-state))]))))



At first the "ok i will mount" message is correctly printed in the console.
But when i change the state. 
The project-view component is correctly rendered but the will-mount method does 
not print nothing


Can someone explain me why ? 

Many thanks, 

Samuel  


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