Remember selected tab

This commit is contained in:
chris (daiyi) 2017-09-06 16:38:55 +02:00 committed by Daniel Compton
parent 2713630f64
commit fcd376b8a4
1 changed files with 11 additions and 7 deletions

View File

@ -322,8 +322,8 @@
showing? (r/atom (localstorage/get "show-panel" false))
dragging? (r/atom false)
pin-to-bottom? (r/atom true)
selected-tab (r/atom :traces)
window-width (r/atom js/window.innerWidth)
selected-tab (r/atom (localstorage/get "selected-tab" :traces))
window-width js/window.innerWidth
handle-window-resize (fn [e]
;; N.B. I don't think this should be a perf bottleneck.
(reset! window-width js/window.innerWidth))
@ -356,6 +356,10 @@
:update-show-panel
(fn [_ _ _ new-state]
(localstorage/save! "show-panel" new-state)))
(add-watch selected-tab
:update-selected-tab
(fn [_ _ _ new-state]
(localstorage/save! "selected-tab" new-state)))
(r/create-class
{:component-will-mount (fn []
(toggle-traces showing?)