mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 07:41:43 -05:00
✨ Prevent leave stream broken on spec failed on commit-changes.
This commit is contained in:
parent
8ae6176242
commit
3db9907c25
1 changed files with 25 additions and 18 deletions
|
@ -67,18 +67,25 @@
|
|||
:as opts}]
|
||||
(us/verify ::cp/changes changes)
|
||||
;; (us/verify ::cp/changes undo-changes)
|
||||
|
||||
(let [error (volatile! nil)]
|
||||
(ptk/reify ::commit-changes
|
||||
cljs.core/IDeref
|
||||
(-deref [_] changes)
|
||||
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(try
|
||||
(let [state (update-in state [:workspace-file :data] cp/process-changes changes)]
|
||||
(cond-> state
|
||||
commit-local? (update :workspace-data cp/process-changes changes))))
|
||||
commit-local? (update :workspace-data cp/process-changes changes)))
|
||||
(catch :default e
|
||||
(vreset! error e)
|
||||
state)))
|
||||
|
||||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
(when-not @error
|
||||
(let [page-id (:current-page-id state)]
|
||||
(rx/concat
|
||||
(when (some :page-id changes)
|
||||
|
@ -87,7 +94,7 @@
|
|||
(when (and save-undo? (seq undo-changes))
|
||||
(let [entry {:undo-changes undo-changes
|
||||
:redo-changes changes}]
|
||||
(rx/of (append-undo entry))))))))))
|
||||
(rx/of (append-undo entry))))))))))))
|
||||
|
||||
(defn generate-operations
|
||||
([ma mb] (generate-operations ma mb false))
|
||||
|
|
Loading…
Add table
Reference in a new issue