mirror of
https://github.com/penpot/penpot.git
synced 2025-05-13 01:56:39 +02:00
🐛 Fix problem with colaborative editing
This commit is contained in:
parent
e43ab51b7d
commit
f92dc6f4b4
2 changed files with 14 additions and 5 deletions
|
@ -323,7 +323,8 @@
|
||||||
:has-media-trimmed false}
|
:has-media-trimmed false}
|
||||||
{:id (:id file)})
|
{:id (:id file)})
|
||||||
|
|
||||||
(let [params (assoc params :file file)]
|
(let [params (-> params (assoc :file file
|
||||||
|
:changes changes))]
|
||||||
;; Send asynchronous notifications
|
;; Send asynchronous notifications
|
||||||
(send-notifications cfg params)
|
(send-notifications cfg params)
|
||||||
|
|
||||||
|
|
|
@ -562,7 +562,7 @@
|
||||||
|
|
||||||
(defn- extract-frame-changes
|
(defn- extract-frame-changes
|
||||||
"Process a changes set in a commit to extract the frames that are channging"
|
"Process a changes set in a commit to extract the frames that are channging"
|
||||||
[[event objects]]
|
[[event [old-objects new-objects]]]
|
||||||
(let [changes (-> event deref :changes)
|
(let [changes (-> event deref :changes)
|
||||||
|
|
||||||
extract-ids
|
extract-ids
|
||||||
|
@ -577,8 +577,11 @@
|
||||||
|
|
||||||
get-frame-id
|
get-frame-id
|
||||||
(fn [id]
|
(fn [id]
|
||||||
(or (and (= :frame (get-in objects [id :type])) id)
|
(let [shape (or (get new-objects id)
|
||||||
(get-in objects [id :frame-id])))
|
(get old-objects id))]
|
||||||
|
|
||||||
|
(or (and (= :frame (:type shape)) id)
|
||||||
|
(:frame-id shape))))
|
||||||
|
|
||||||
;; Extracts the frames and then removes nils and the root frame
|
;; Extracts the frames and then removes nils and the root frame
|
||||||
xform (comp (mapcat extract-ids)
|
xform (comp (mapcat extract-ids)
|
||||||
|
@ -613,7 +616,12 @@
|
||||||
(rx/filter #(or (= :app.main.data.workspace/finalize-page (ptk/type %))
|
(rx/filter #(or (= :app.main.data.workspace/finalize-page (ptk/type %))
|
||||||
(= ::watch-state-changes (ptk/type %)))))
|
(= ::watch-state-changes (ptk/type %)))))
|
||||||
|
|
||||||
objects-stream (rx/from-atom refs/workspace-page-objects {:emit-current-value? true})
|
objects-stream (->> (rx/concat
|
||||||
|
(rx/of nil)
|
||||||
|
(rx/from-atom refs/workspace-page-objects {:emit-current-value? true}))
|
||||||
|
;; We need to keep the old-objects so we can check the frame for the
|
||||||
|
;; deleted objects
|
||||||
|
(rx/buffer 2 1))
|
||||||
|
|
||||||
frame-changes (->> stream
|
frame-changes (->> stream
|
||||||
(rx/filter dch/commit-changes?)
|
(rx/filter dch/commit-changes?)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue