            {:id :setup   :label "setup"     :panel (wrap-page [setup-panel])}])
 
 (defn tab-panel []
-  (let [page (re-frame/subscribe [:page])]
-    (fn []
-      (:panel (or (first (filter #(= (:id %) @page)
-                                 tabs))
-                  :home-panel)))))
+  (:panel (or (first (filter #(= (:id %) (<sub [:page]))
+                             tabs))
+              :home-panel)))
 
 (defn tabs-row []
-  (let [page (re-frame/subscribe [:page])
-        server (re-frame/subscribe [:server])]
-    (fn []
-      [re-com/horizontal-pill-tabs
-       :tabs tabs
-       :model (or @page :home)
-       :on-change #(routes/goto-page % @server)])))
+  [re-com/horizontal-pill-tabs
+   :tabs tabs
+   :model (or (<sub [:page]) :home)
+   :on-change #(routes/goto-page % (<sub [:server]))])
 
 (defn main-panel []
   (let [schema (re-frame/subscribe [:schema])]

   :disabled? true])

(defn history-panel []
  (let [user (re-frame/subscribe [:user])
        history (re-frame/subscribe [:history])
        csv (re-frame/subscribe [:history-csv])]
    (fn []
      (if @user
        (let [consumer? (:user/isConsumer @user)
              editor? (:user/isEditor @user)
              admin? (:user/isAdmin @user)]
          [re-com/v-box
           :gap title-gap
           :children [(panel-title "History")
                      [re-com/scroller
                       :scroll :auto
                       :child [history-table @history]]
                      (when admin?
                        [history-csv @csv])
                      [re-com/h-box
                       :children [(button [:get-history] "Refresh History" "Load history from server")]]]])
        [login-panel]))))

(defn formatted-schema [title schema-part only-dynamic?]
  [re-com/v-box

                        :choices [{:id :production :label "production"}
                                  {:id :development :label "development"}]
                        :width tight-field-width
                        :model (<sub [:server])
                        :on-change #(>evt [:set-server %])]])
                    (when admin?
                      [re-com/v-box
                       :align :end
