mirror of
https://github.com/penpot/penpot.git
synced 2025-06-24 15:07:00 +02:00
🐛 Fix problem in wasm when duplicate objects
This commit is contained in:
parent
ad842872fb
commit
e8d1ea24d1
1 changed files with 29 additions and 15 deletions
|
@ -274,6 +274,14 @@
|
||||||
(rx/map bundle-fetched)
|
(rx/map bundle-fetched)
|
||||||
(rx/take-until stopper-s))))))
|
(rx/take-until stopper-s))))))
|
||||||
|
|
||||||
|
(defn process-wasm-object
|
||||||
|
[id]
|
||||||
|
(ptk/reify ::process-wasm-object
|
||||||
|
ptk/EffectEvent
|
||||||
|
(effect [_ state _]
|
||||||
|
(let [objects (dsh/lookup-page-objects state)]
|
||||||
|
(api/process-object (get objects id))))))
|
||||||
|
|
||||||
(defn initialize-workspace
|
(defn initialize-workspace
|
||||||
[team-id file-id]
|
[team-id file-id]
|
||||||
(assert (uuid? team-id) "expected valud uuid for `team-id`")
|
(assert (uuid? team-id) "expected valud uuid for `team-id`")
|
||||||
|
@ -361,24 +369,30 @@
|
||||||
(rx/take 1)
|
(rx/take 1)
|
||||||
(rx/map #(dwcm/navigate-to-comment-id comment-id))))
|
(rx/map #(dwcm/navigate-to-comment-id comment-id))))
|
||||||
|
|
||||||
|
(when render-wasm?
|
||||||
|
(->> stream
|
||||||
|
(rx/filter dch/commit?)
|
||||||
|
(rx/map deref)
|
||||||
|
(rx/mapcat
|
||||||
|
(fn [{:keys [redo-changes]}]
|
||||||
|
(let [added (->> redo-changes
|
||||||
|
(filter #(= (:type %) :add-obj))
|
||||||
|
(map :id))]
|
||||||
|
(->> (rx/from added)
|
||||||
|
(rx/map process-wasm-object)))))))
|
||||||
|
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter dch/commit?)
|
(rx/filter dch/commit?)
|
||||||
(rx/map deref)
|
(rx/map deref)
|
||||||
(rx/mapcat (fn [{:keys [save-undo? undo-changes redo-changes undo-group tags stack-undo?]}]
|
(rx/mapcat
|
||||||
(when render-wasm?
|
(fn [{:keys [save-undo? undo-changes redo-changes undo-group tags stack-undo?]}]
|
||||||
(let [added (->> redo-changes
|
(if (and save-undo? (seq undo-changes))
|
||||||
(filter #(= (:type %) :add-obj))
|
(let [entry {:undo-changes undo-changes
|
||||||
(map :obj))]
|
:redo-changes redo-changes
|
||||||
(doseq [shape added]
|
:undo-group undo-group
|
||||||
(api/process-object shape))))
|
:tags tags}]
|
||||||
|
(rx/of (dwu/append-undo entry stack-undo?)))
|
||||||
(if (and save-undo? (seq undo-changes))
|
(rx/empty))))))
|
||||||
(let [entry {:undo-changes undo-changes
|
|
||||||
:redo-changes redo-changes
|
|
||||||
:undo-group undo-group
|
|
||||||
:tags tags}]
|
|
||||||
(rx/of (dwu/append-undo entry stack-undo?)))
|
|
||||||
(rx/empty))))))
|
|
||||||
(rx/take-until stoper-s))))
|
(rx/take-until stoper-s))))
|
||||||
|
|
||||||
ptk/EffectEvent
|
ptk/EffectEvent
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue