fixes a couple of dropdown-related bugs.

This commit is contained in:
2024-04-17 23:29:04 -07:00
parent 705cab9435
commit 61338dd4fc
3 changed files with 17 additions and 17 deletions

View File

@@ -77,12 +77,10 @@
(and token
last-client-id
(not last-selected-clients))
[(js/parseInt last-client-id)]
{:selected [(js/parseInt last-client-id)]}
:else
nil)]
(cond
(= :login handler)
{:db (cond-> (assoc db/default-db
@@ -135,11 +133,11 @@
::received-initial
(fn [{:keys [db]} [_ {clients :client}]]
(let [only-one-client (when (= 1 (count clients))
(->> clients first :id))]
(->> clients first :id js/parseInt))]
(when only-one-client
(.setItem js/localStorage "last-client-id" only-one-client)
(.setItem js/localStorage "last-selected-clients"
(pr-str [(js/parseInt only-one-client)])))
(.stringify js/JSON (clj->js {:selected [only-one-client]}))))
{:db (cond-> (-> db
(assoc :clients (by :id clients))
(assoc :is-initial-loading? false)
@@ -149,7 +147,7 @@
(filter #(= % (:last-client-id db)))
first))))
only-one-client (assoc :last-client-id only-one-client
:selected-clients [only-one-client]))
:selected-clients {:selected [only-one-client]}))
:interval {:action :start
:id :refresh-clients
:frequency 600000