 
 (defn devices-div [tables owner]
   (reify
+    om/IDidUpdate
+    (did-update [_ prev-props prev-state]
+      (let [{:keys [properties devices active-components]} tables
+            new-property-id (:properties active-components)]
+
+        (println "Active Components: " active-components)
+
+        ;; handle selection perties table
+        (when-not new-property-id
+          (println "Clearing devices data.")
+          (om/update! devices :data [])
+          (om/update! devices :selected nil))
+        
+        (if (and new-property-id
+                 (not (= (:property-id devices) new-property-id)))
+          (GET (str "/4/entities/" new-property-id "/devices/")
+               {:handler  (fn [x]
+                            (println "Fetching devices for property: " new-property-id)
+                            (om/update! devices :data x)
+                            (om/update! devices :selected nil))
+                ;; TODO: Add Error Handler
+                ;; FIXME: This should be application/edn
+                :headers {"Accept" "application/json"}
+                :response-format :json
+                :keywords? true})
+          (println "Not fetching devices!"))
+        (om/update! devices :property-id new-property-id)
+
+        ;; handle seledevices table
+        (om/update! devices :selected (:devices active-components))))
     om/IRender
     (render [_]
       (let [{:keys [programmes projects properties devices active-components]} tables

                                                       template
                                                       nav-event)]

      (om/update! data :active-components (-> nav-event :args :ids))
      
      (when uri
        (println "Fetching: " uri)

                  :response-format :text}
                 (cond-> (= content-type "application/json")
                         (merge {:response-format :json :keywords? true}))))))
    (recur)))

(defn history-loop [history-channel tables]
  (go-loop []
    (let [nav-event (<! history-channel)]
      (om/update! tables :active-components (-> nav-event :args :ids)))
    (recur)))

(defn selected-range-change
