 (defn ajax [in data path {:keys [template selection-key content-type]} & [chart]]
   (go-loop []
     (let [nav-event (<! in)
-          active-components (-> nav-event :args :ids keys set)
-          components [:programmes :projects :properties :devices :sensors :measurements] ; FIXME
-          to-clear (remove #(active-components %) components)
           [new-selected uri] (uri-for-selection-change (:selected @data)
                                                        selection-key
                                                        template
                                                        nav-event)]
 
-
       (om/update! data :active-components (-> nav-event :args :ids))
       
-      (doseq [a active-components]
-        (om/update! data (vector a :active) true))
-      
-      (doseq [c to-clear]
-        (om/update! data (vector c :active) false)
-        (om/update! data (vector c :data) [])
-        (om/update! data (vector c :selected) nil))
-      
       (when uri
+        (println "Fetching: " uri)
         (GET uri
              (-> {:handler  (fn [x]
                               (when (= selection-key :sensors)


(defn programmes-div [tables owner]
  (reify
    om/IRender
    (render [_]
      (let [programmes (-> tables :programmes)]
        (html
         ;; hide div if we've already chosen something
         [:div {:id "programmes-div"}
          [:h1 "Programmes"]
          (om/build programmes-table programmes)])))))

              m           (mult (history/set-chan! history (chan)))
              tap-history #(tap m (chan))]
          
          ;; (ajax (tap-history) tables [:programmes] {:template      "/4/programmes/"
          ;;                                           :content-type  "application/edn"
          ;;                                           :selection-key :programmes})
          ;; (ajax (tap-history) tables [:projects] {:template      "/4/programmes/:programmes/projects/"
          ;;                                         :content-type  "application/edn"
          ;;                                         :selection-key :projects})
          ;; (ajax (tap-history) tables [:properties] {:template      "/4/projects/:projects/properties/"
          ;;                                           :content-type "application/json"
          ;;                                           :selection-key :properties})
          (ajax (tap-history) tables [:devices] {:template      "/4/entities/:properties/devices/"
                                                 :content-type  "application/json"
                                                 :selection-key :devices})
