🐛 Fix component changes not propagated

This commit is contained in:
Alejandro Alonso 2025-07-23 12:00:13 +02:00
parent 97fc7702b8
commit ade5eecf80
2 changed files with 23 additions and 13 deletions

View file

@ -1095,15 +1095,24 @@
(when (seq (:redo-changes changes)) (when (seq (:redo-changes changes))
(rx/of (dch/commit-changes changes))) (rx/of (dch/commit-changes changes)))
(when-not (empty? updated-frames) (when-not (empty? updated-frames)
(rx/merge (let [frames-by-page (->> updated-frames
(rx/of (ptk/data-event :layout/update {:ids (map :id updated-frames) :undo-group undo-group})) (group-by :page-id))]
(->> (rx/from updated-frames) (rx/merge
(rx/mapcat ;; Emit one layout/update event for each page
(fn [shape] (rx/from
(rx/of (map (fn [[page-id frames]]
(dwt/clear-thumbnail file-id (:page-id shape) (:id shape) "frame") (ptk/data-event :layout/update
(when-not (= (:frame-id shape) uuid/zero) {:page-id page-id
(dwt/clear-thumbnail file-id (:page-id shape) (:frame-id shape) "frame")))))))) :ids (map :id frames)
:undo-group undo-group}))
frames-by-page))
(->> (rx/from updated-frames)
(rx/mapcat
(fn [shape]
(rx/of
(dwt/clear-thumbnail file-id (:page-id shape) (:id shape) "frame")
(when-not (= (:frame-id shape) uuid/zero)
(dwt/clear-thumbnail file-id (:page-id shape) (:frame-id shape) "frame")))))))))
(when (not= file-id library-id) (when (not= file-id library-id)
;; When we have just updated the library file, give some time for the ;; When we have just updated the library file, give some time for the

View file

@ -131,11 +131,12 @@
;; they are process together. It will get a better performance. ;; they are process together. It will get a better performance.
(rx/buffer-time 100) (rx/buffer-time 100)
(rx/filter #(d/not-empty? %)) (rx/filter #(d/not-empty? %))
(rx/map (rx/mapcat
(fn [data] (fn [data]
(let [page-id (->> data (keep :page-id) first) (->> (group-by :page-id data)
ids (reduce #(into %1 (:ids %2)) #{} data)] (map (fn [[page-id items]]
(update-layout-positions {:page-id page-id :ids ids})))) (let [ids (reduce #(into %1 (:ids %2)) #{} items)]
(update-layout-positions {:page-id page-id :ids ids})))))))
(rx/take-until stopper)))))) (rx/take-until stopper))))))
(defn finalize-shape-layout (defn finalize-shape-layout