mirror of
https://github.com/penpot/penpot.git
synced 2026-06-16 04:12:03 +00:00
🐛 Fix race condition on trying to persist file changes after going to dashboard
This commit is contained in:
parent
ee6489b202
commit
2a9879139f
@ -209,7 +209,8 @@
|
||||
permissions (get state :permissions)]
|
||||
|
||||
;; Prevent commit changes by a viewer team member (it really should never happen)
|
||||
(when (:can-edit permissions)
|
||||
;; or if there is no file
|
||||
(when (and (:can-edit permissions) file-id)
|
||||
(log/trace :hint "commit-changes" :redo-changes redo-changes)
|
||||
(let [selected (dm/get-in state [:workspace-local :selected])]
|
||||
(rx/of (-> params
|
||||
|
||||
@ -121,9 +121,11 @@
|
||||
:features features}
|
||||
permissions (:permissions state)]
|
||||
|
||||
;; Prevent saving changes when in version preview (read-only) mode
|
||||
;; or when the user does not have edition permission.
|
||||
(when (and (:can-edit permissions)
|
||||
;; Prevent saving changes when in version preview (read-only) mode,
|
||||
;; when the user does not have edition permission, or when file-id is nil
|
||||
;; (race condition: navigation can clear :current-file-id before commit fires).
|
||||
(when (and file-id
|
||||
(:can-edit permissions)
|
||||
(not (get-in state [:workspace-global :read-only?])))
|
||||
(->> (rp/cmd! :update-file params)
|
||||
(rx/mapcat (fn [{:keys [revn lagged] :as response}]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user