0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 14:39:45 -05:00

🐛 Fix grid not syncing in multi user

This commit is contained in:
Alejandro Alonso 2022-10-13 13:04:46 +02:00 committed by Eva
parent 4b52612682
commit 87d323bb4c
2 changed files with 19 additions and 8 deletions

View file

@ -43,6 +43,7 @@
- Fix components marked as touched when moved [Taiga #4061](https://tree.taiga.io/project/penpot/task/4061)
- Fix boards grouped shouldn't show the title [Taiga #4251](https://tree.taiga.io/project/penpot/issue/4251)
- Fix gradient handlers are under resize handlers[Taiga #4298](https://tree.taiga.io/project/penpot/issue/4298)
- Fix grid not syncing immediately in multiuser [Taiga #4339](https://tree.taiga.io/project/penpot/issue/4339)
### :arrow_up: Deps updates
### :heart: Community contributions by (Thank you!)

View file

@ -12,6 +12,7 @@
[app.common.pages.changes-spec :as pcs]
[app.common.spec :as us]
[app.common.types.file :as ctf]
[app.common.types.shape-tree :as ctst]
[app.common.uuid :as uuid]
[app.config :as cf]
[app.main.data.dashboard :as dd]
@ -219,14 +220,23 @@
(ptk/reify ::changes-persisted
ptk/UpdateEvent
(update [_ state]
(if (= file-id (:current-file-id state))
(-> state
(update-in [:workspace-file :revn] max revn)
(update :workspace-data cp/process-changes changes))
(-> state
(update-in [:workspace-libraries file-id :revn] max revn)
(update-in [:workspace-libraries file-id :data]
cp/process-changes changes))))))
(let [changes (group-by :page-id changes)]
(if (= file-id (:current-file-id state))
(-> state
(update-in [:workspace-file :revn] max revn)
(update :workspace-data (fn [file]
(loop [fdata file
entries (seq changes)]
(if-let [[page-id changes] (first entries)]
(recur (-> fdata
(cp/process-changes changes)
(ctst/update-object-indices page-id))
(rest entries))
fdata)))))
(-> state
(update-in [:workspace-libraries file-id :revn] max revn)
(update-in [:workspace-libraries file-id :data]
cp/process-changes changes)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;