Preserve ordering of paths by storing as a list, not a set
This commit is contained in:
parent
0c42aff532
commit
9391d1c162
|
@ -7,7 +7,7 @@
|
|||
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" '())]
|
||||
(rf/dispatch [:settings/panel-width% panel-width%])
|
||||
(rf/dispatch [:settings/show-panel? show-panel?])
|
||||
(rf/dispatch [:settings/selected-tab selected-tab])
|
||||
|
|
|
@ -152,13 +152,14 @@
|
|||
(rf/reg-event-db
|
||||
:app-db/paths
|
||||
(fn [db [_ paths]]
|
||||
(let [new-paths (into [] paths)] ;; Don't use sets, use vectors
|
||||
(localstorage/save! "app-db-paths" paths)
|
||||
(assoc-in db [: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)]
|
||||
(let [new-db (update-in db [:app-db :paths] #(remove (fn [p] (= p path)) %))]
|
||||
(localstorage/save! "app-db-paths" (get-in new-db [:app-db :paths]))
|
||||
new-db)))
|
||||
|
||||
|
@ -172,9 +173,10 @@
|
|||
(catch :default e
|
||||
nil))]
|
||||
(if (some? path)
|
||||
(do (localstorage/save! "app-db-paths" (cons path (get-in db [:app-db :paths])))
|
||||
(-> db
|
||||
(update-in [:app-db :paths] conj path)
|
||||
(assoc-in [:app-db :search-string] ""))
|
||||
(update-in [:app-db :paths] #(cons path %))
|
||||
(assoc-in [:app-db :search-string] "")))
|
||||
db))))
|
||||
|
||||
(rf/reg-event-db
|
||||
|
|
Loading…
Reference in New Issue