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

        (html
         [:table {:className "table table-hover"}
          [:thead
           [:tr [:th "Address"] [:th "Country"]]]
          [:tbody
           (for [row (sort-by :name (:data properties))]
             (let [{:keys [id addressStreetTwo country]} row]
               [:tr {:onClick (fn [_ _]
                                (om/update! properties :selected id)
                                (history/update-token-ids! history :properties id)
                                (fixed-scroll-to-element "devices-div"))
                     :className (if (= id (:selected properties)) "success")
                     :id (str table-id "-selected")}
                [:td addressStreetTwo]
                [:td country]]))]])))))

(defn properties-div [tables owner]
  (reify
    om/IRender
    (render [_]
      (let [{:keys [programmes projects properties active-components]} tables

  (reify
    om/IDidUpdate
    (did-update [_ prev-props prev-state]
      (let [{:keys [programmes projects active-components]} tables
            new-programme-id (:programmes active-components)]

        ;; handle selection in programme table
        (when-not new-programme-id
          (om/update! projects :data [])
          (om/update! projects :selected nil))

        ;; get the data if we have a new id
        (if (and new-programme-id
                   (not (= (:programme-id projects) new-programme-id)))
          (GET (str "/4/programmes/" new-programme-id "/projects/")
               {:handler  (fn [x]
                            (println "Fetching projects for programme: " new-programme-id)
                            (om/update! projects :data x)
                            (om/update! projects :selected nil))
                ;; TODO: Add Error Handler
                :headers {"Accept" "application/edn"}
                :response-format :text})
          (println "Not fetching projects!"))

        ;; update our current id with the new one
        (om/update! projects :programme-id new-programme-id)

        ;; handle selection in projects table
        (om/update! projects :selected (:projects active-components))))
    om/IRender
    (render [_]
      (let [{:keys [programmes projects active-components]} tables
