fix: selected choices not updated reactively on UI

This commit is contained in:
Tienson Qin
2024-05-22 06:45:45 +08:00
parent 49d954f3b1
commit a1d4bca586

View File

@@ -52,6 +52,11 @@
{:init (fn [state]
(assoc state ::selected-choices
(atom (set (:selected-choices (first (:rum/args state)))))))
:will-remount (fn [_old-state new-state]
(let [choices (set (:selected-choices (first (:rum/args new-state))))]
(when (not= choices @(::selected-choices new-state))
(reset! (::selected-choices new-state) choices))
new-state))
:will-unmount (fn [state]
(state/set-state! [:ui/open-select] nil)
state)}