      [:td (:url tab)]]))
 
 (defn tab-list []
-  (let [tabs (reaction (filter-tabs @(subscribe [:tabs])))]
+  (let [tabs (reaction (filter-tabs @(subscribe [:data :tabs])))]
     (fn []
       [:div
        [:div {:class "page-header"} [:h2 "Current tabs"]]

  :tab-removed
  (fn [app-state [_ msg]]
    (console/trace "Removed:" (:tabId msg) msg)
    (assoc app-state :tabs (remove-tab (:tabs app-state) (:tabId msg)))))

(register-handler
  :tab-replaced

    (console/trace "Replaced:" msg)
    ; We don't need to create a new item for the tab being added, as
    ; we'll also get an "update" message which will add it.
    (assoc-in app-state [:data :tabs] (remove-tab (get-in app-state [:data :tabs]) (:removed msg)))))


(register-handler
  :tabset-save
  (fn [app-state [_]]
    (let [tabs    (get-in app-state [:data :tabs])
          to-save (map (fn [m] (select-keys m [:index :url :id :title])) tabs)
          groups  (conj (or (get-in app-state [:data :groups]) '())
                        (group-from-tabs to-save))]
      (storage/set {:groups groups})
      (assoc-in app-state [:data :groups] groups))
    ))


