 (defmethod item-ui :ref/js [step stack opts]
   (item-ui (conj step :js) stack))
 
+(defn open-sub-step [stack id]
+  (let [opened (from-cache [:open-paths])
+        stack-count (count stack)]
+    (if (get opened stack)
+      (assoc-cache! [:open-paths stack] nil)
+      ;;TODO: this will close things from other notebooks/pages - that's probably wrong.
+      (assoc-cache! [:open-paths] (reduce (fn [final [path v]]
+                                            (if (< (count path) stack-count)
+                                              (assoc final path v)
+                                              final))
+                                          {stack id}
+                                          opened)))))
+
 (defmethod item-ui :ref/id [step stack opts]
   (dom
    (let [page (cursor (:id @step))

  [:ul
   (each [[ref args] [[(ref-js "cljs.core._PLUS_") (fn [] [1 2])]
                      [(ref-js "cljs.core.mapv") (fn []
                                                   (let [func (add-page! (current :notebook) "each thing" {:args ["current"]})]
                                                     [(ref-id (:id func)) [1 2 3]])
                                                   )]]]
         [:li [:button {:onClick (fn []

           (item-ui (value-cursor res))]
      page? [:span {:className "ref"
                    :onClick (fn []
                               (open-sub-step stack (:id @step)))
               :onContextMenu (ref-menu step stack)}
             [:span {:className "value"}
              (or (:desc @page) (:id @page))]]
