diff --git a/src/day8/re_frame/trace/events.cljs b/src/day8/re_frame/trace/events.cljs index 045db0d..3570ac1 100644 --- a/src/day8/re_frame/trace/events.cljs +++ b/src/day8/re_frame/trace/events.cljs @@ -81,3 +81,10 @@ (fn [db [_ paths]] (localstorage/save! "app-db-paths" paths) (assoc-in db [:app-db :paths] paths))) + +(rf/reg-event-db + :app-db/remove-path + (fn [db [_ path]] + (let [new-db (update-in db [:app-db :paths] disj path)] + (localstorage/save! "app-db-paths" (get-in new-db [:app-db :paths])) + new-db))) diff --git a/src/day8/re_frame/trace/panels/app_db.cljs b/src/day8/re_frame/trace/panels/app_db.cljs index f842a49..9b07440 100644 --- a/src/day8/re_frame/trace/panels/app_db.cljs +++ b/src/day8/re_frame/trace/panels/app_db.cljs @@ -144,7 +144,7 @@ [:div.subtree [subtree (get-in @data path) - [:button.subtree-button {:on-click #(swap! subtree-paths disj path)} + [:button.subtree-button {:on-click #(rf/dispatch [:app-db/remove-path path])} [:span.subtree-button-string (str path)]]]]]) @subtree-paths))]