Wire up theme updating

This commit is contained in:
Florian Schroedl 2024-08-26 14:17:30 +02:00
parent 70b570f112
commit 7aff690e7b
2 changed files with 62 additions and 35 deletions

View file

@ -102,6 +102,17 @@
(rx/of
(dch/commit-changes changes)))))))
(defn update-token-theme [token-theme]
(ptk/reify ::update-token-theme
ptk/WatchEvent
(watch [it state _]
(let [prev-token-theme (wtts/get-workspace-token-theme state (:id token-theme))
changes (-> (pcb/empty-changes it)
(pcb/update-token-theme token-theme prev-token-theme))]
(js/console.log "changes" changes)
(rx/of
(dch/commit-changes changes))))))
(defn ensure-token-theme-changes [changes state {:keys [id new-set?]}]
(let [theme-id (wtts/update-theme-id state)
theme (some-> theme-id (wtts/get-workspace-token-theme state))]