0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-25 06:01:46 -05:00

🐛 Fix sometimes sync of adding/removing shapes fails

This commit is contained in:
Pablo Alba 2023-12-05 14:38:09 +01:00
parent fa90403d84
commit 6a5d9402d5

View file

@ -1070,13 +1070,18 @@
(= ::watch-component-changes (ptk/type %)))))
workspace-data-s
(->> (rx/from-atom refs/workspace-data {:emit-current-value? true})
(rx/share))
workspace-buffer-s
(->> (rx/concat
(rx/of nil)
(rx/from-atom refs/workspace-data {:emit-current-value? true}))
;; Need to get the file data before the change, so deleted shapes
;; still exist, for example
(rx/buffer 3 1)
(rx/filter (fn [[old-data]] (some? old-data))))
(rx/take 1 workspace-data-s)
(rx/take 1 workspace-data-s)
workspace-data-s)
;; Need to get the file data before the change, so deleted shapes
;; still exist, for example. We initialize the buffer with three
;; copies of the initial state
(rx/buffer 3 1))
changes-s
(->> stream
@ -1106,7 +1111,7 @@
changes-s
(->> changes-s
(rx/with-latest-from workspace-data-s)
(rx/with-latest-from workspace-buffer-s)
(rx/mapcat check-changes)
(rx/share))