Right, this is standard asynchronous programming.  It takes awhile to wrap your 
head around it if you haven't done much of it before.

It looks like you are using the session namespace from Dmitri's examples 
(excellent starting point, BTW).  Since this is already wrapping a reagent 
atom, the easiest fix is to just have your 'rules-page' pull the data from the 
session:

(defn rules-page []
  (let [error? (session/get :error)]
    (if error?
      [hel/err-snippet]
      [rules-page-snippet (session/get :data)])))

Now you need to move your ajax call to a separate function:

(defn do-load-data []
  (GET "/datamodel/get-trans"
        {:handler       (fn [res]
                          (session/put! :error false)
                          (session/put! :data %))
         :error-handler #(session/put! :error true)}))  

Now you can call do-load-data to initialize the data (probably from some 'init' 
function) or just whenever you need to refresh from the server.

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