                           .-value)
         new-item [(swap! id-atom inc) new-item-text]]
     (when new-item
+      ;; TODO: transact to server before stuff adding, no?
+      ;; id should be returned, not this swap! id-atom biz
+      ;; or use uuid gen on client, but not well-ordered then
+      (put! comm-alt {:tag :add-note! :value new-item})
+
       (om/transact! app :word-map #(merge-with union % (make-word-map new-item)))
       (om/transact! app :items #(conj % new-item))
-      ;; TODO: transact to server
       (secretary/dispatch! (str "#/notes/" (first new-item)))
       (set! (.-location js/window) (str "/#notes/" (first new-item))))))
 

                                      {:value (:text state)
                                       :ref "new-item"
                                       :rows "12" :cols "80"
                                       :onChange #(handle-item-change % owner state)})
                        (dom/button #js {:onClick #(add-item app owner)} "Add item"))
               ))))

(defroute "/notes/:id" {:as params}
  (put! comm-alt {:tag :notes
                  :value {:id (:id params)}}))

(defroute "/add" {}
  (put! comm-alt {:tag :add :value {}}))

(defroute "/search" {}
  (put! comm-alt {:tag :search :value {}}))

(defroute "/about" {}
  (put! comm-alt {:tag :notes :value {:id 0}}))

(defn main []
  (om/root app-view


;; Link format: [[foo|blitz]]

(defn debug [s x]
  (. js/console (log s (pr-str x))))

;; global extra channel for outer-Om comms
 (def comm-alt (chan (sliding-buffer 1)))

