                  {:component-did-mount #(.focus (reagent/dom-node %))}))
 
 (defn stats-footer []
-  (let [footer-stats (subscribe :footer-stats)]
+  (let [footer-stats (subscribe [:footer-stats])]
     (fn []
       (let [[active done filter] @footer-stats
             props-for (fn [filter-kw]

  (fn 
    [_ _]
    {:todos   (sorted-map)
     :showing :all}
    #_(merge db initial-db)))

(register-pure-handler
  :set-showing
  (comp undoable trim-v)     ;; middleware
  (fn
    [db [filter-kw]]
    (assoc db :showing filter-kw)))

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

(defn main-panel
  []
  (let [initialised? (subscribe  [:initialised?])]
    (fn []
      (if @initialised?
        [todo-app]
        [:div "Loading ...."]))))

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

                 ;; you must always return the db