Save traces and detail expansions to localstorage

fixes #54
This commit is contained in:
Saskia Lindner 2017-08-25 11:23:07 +02:00
parent 3991c46ae7
commit 0c336605f3
1 changed files with 11 additions and 2 deletions

View File

@ -94,7 +94,8 @@
(real-schedule)))))
(def traces (interop/ratom []))
(def traces (interop/ratom (localstorage/get "traces" [])))
(defn log-trace? [trace]
(let [rendering? (= (:op-type trace) :render)]
(if-not rendering?
@ -191,7 +192,15 @@
filter-items (r/atom (localstorage/get "filter-items" []))
filter-type (r/atom :contains)
input-error (r/atom false)
trace-detail-expansions (r/atom {:show-all? false :overrides {}})]
trace-detail-expansions (r/atom (localstorage/get "trace-detail-expansion" {:show-all? false :overrides {}}))]
(add-watch traces
:update-traces
(fn [_ _ _ new-state]
(localstorage/save! "traces" new-state)))
(add-watch trace-detail-expansions
:update-trace-detail-expansions
(fn [_ _ _ new-state]
(localstorage/save! "trace-detail-expansion" new-state)))
(add-watch filter-items
:update-localstorage
(fn [_ _ _ new-state]