 
 ;; -- Subscriptions ---------
 
+
+(register-sub
+  :initialised?
+  (fn
+    [db _]
+    (reaction (not= {} @db))))
+
 (register-sub
   :visible-todos
   (fn
     [db _]
+
     (let [todos     (reaction (:todos @db))
           showing   (reaction (:showing @db))
+          _         (println @showing)
           filter-fn (case @showing
                       :active (complement :done)
                       :done :done

       [:footer#info
        [:p "Double-click to edit a todo"]]])))

(defn ^:export run
  []
  (dispatch [:initialise-db])
  (reagent/render [todo-app] (js/document.getElementById "app")))

;;
;; Middleware means our handlers are pure and simple.
;;
(def todo-middleware (comp (path [:todos]) trim-v))


;; -- Handlers -------------
