diff --git a/src/day8/re_frame/trace/db.cljs b/src/day8/re_frame/trace/db.cljs index f68410d..0544f10 100644 --- a/src/day8/re_frame/trace/db.cljs +++ b/src/day8/re_frame/trace/db.cljs @@ -7,13 +7,14 @@ show-panel? (localstorage/get "show-panel" false) selected-tab (localstorage/get "selected-tab" :traces) filter-items (localstorage/get "filter-items" []) - app-db-paths (localstorage/get "app-db-paths" '())] + app-db-paths (localstorage/get "app-db-paths" '()) + json-ml-paths (localstorage/get "app-db-json-ml-expansions" #{})] (rf/dispatch [:settings/panel-width% panel-width%]) (rf/dispatch [:settings/show-panel? show-panel?]) (rf/dispatch [:settings/selected-tab selected-tab]) (rf/dispatch [:traces/filter-items filter-items]) (rf/dispatch [:app-db/paths app-db-paths]) - (rf/dispatch [:app-db/set-json-ml-paths #{}]) + (rf/dispatch [:app-db/set-json-ml-paths json-ml-paths]) (rf/dispatch [:global/add-unload-hook]) (when show-panel? (rf/dispatch [:global/enable-tracing])))) diff --git a/src/day8/re_frame/trace/events.cljs b/src/day8/re_frame/trace/events.cljs index 6de247c..1d85a00 100644 --- a/src/day8/re_frame/trace/events.cljs +++ b/src/day8/re_frame/trace/events.cljs @@ -186,13 +186,17 @@ (rf/reg-event-db :app-db/set-json-ml-paths + [(rf/path [:app-db :json-ml-expansions])] (fn [db [_ paths]] - (assoc-in db [:app-db :json-ml-paths] paths))) + (localstorage/save! "app-db-json-ml-expansions" paths) + paths)) (rf/reg-event-db :app-db/toggle-expansion - [(rf/path [:app-db :json-ml-paths])] + [(rf/path [:app-db :json-ml-expansions])] (fn [paths [_ path]] - (if (contains? paths path) - (disj paths path) - (conj paths path)))) + (let [new-paths (if (contains? paths path) + (disj paths path) + (conj paths path))] + (localstorage/save! "app-db-json-ml-expansions" new-paths) + new-paths))) diff --git a/src/day8/re_frame/trace/subs.cljs b/src/day8/re_frame/trace/subs.cljs index 8a594f5..a1feb8b 100644 --- a/src/day8/re_frame/trace/subs.cljs +++ b/src/day8/re_frame/trace/subs.cljs @@ -47,7 +47,7 @@ :app-db/expansions :<- [:app-db/root] (fn [app-db-settings _] - (get app-db-settings :json-ml-paths))) + (get app-db-settings :json-ml-expansions))) (rf/reg-sub :app-db/node-expanded?