mirror of
https://github.com/penpot/penpot.git
synced 2025-01-25 07:58:49 -05:00
🐛 Clear persistence status on server error
This avoids the problem of permanently keeping on the persistence queue a problematic change.
This commit is contained in:
parent
195305e4c8
commit
f463a1989f
1 changed files with 8 additions and 2 deletions
|
@ -96,6 +96,13 @@
|
||||||
(rx/of (run-persistence-task)
|
(rx/of (run-persistence-task)
|
||||||
(update-status :saving))))))))
|
(update-status :saving))))))))
|
||||||
|
|
||||||
|
(defn- discard-persistence-state
|
||||||
|
[]
|
||||||
|
(ptk/reify ::discard-persistence-state
|
||||||
|
ptk/UpdateEvent
|
||||||
|
(update [_ state]
|
||||||
|
(dissoc state :persistence))))
|
||||||
|
|
||||||
(defn- persist-commit
|
(defn- persist-commit
|
||||||
[commit-id]
|
[commit-id]
|
||||||
(ptk/reify ::persist-commit
|
(ptk/reify ::persist-commit
|
||||||
|
@ -114,7 +121,6 @@
|
||||||
:changes (vec changes)
|
:changes (vec changes)
|
||||||
:features features}]
|
:features features}]
|
||||||
|
|
||||||
;; FIXME: handle lagged here !!!!
|
|
||||||
(->> (rp/cmd! :update-file params)
|
(->> (rp/cmd! :update-file params)
|
||||||
(rx/mapcat (fn [{:keys [revn lagged] :as response}]
|
(rx/mapcat (fn [{:keys [revn lagged] :as response}]
|
||||||
(log/debug :hint "changes persisted" :commit-id (dm/str commit-id) :lagged (count lagged))
|
(log/debug :hint "changes persisted" :commit-id (dm/str commit-id) :lagged (count lagged))
|
||||||
|
@ -128,6 +134,7 @@
|
||||||
(rx/of (rt/assign-exception cause)
|
(rx/of (rt/assign-exception cause)
|
||||||
(ptk/data-event ::error cause)
|
(ptk/data-event ::error cause)
|
||||||
(update-status :error)))
|
(update-status :error)))
|
||||||
|
(rx/of (discard-persistence-state))
|
||||||
(rx/throw cause))))))))))
|
(rx/throw cause))))))))))
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,7 +180,6 @@
|
||||||
(assoc :redo-changes rchg)
|
(assoc :redo-changes rchg)
|
||||||
(assoc :changes rchg)))))))
|
(assoc :changes rchg)))))))
|
||||||
|
|
||||||
|
|
||||||
(defn initialize-persistence
|
(defn initialize-persistence
|
||||||
[]
|
[]
|
||||||
(ptk/reify ::initialize-persistence
|
(ptk/reify ::initialize-persistence
|
||||||
|
|
Loading…
Add table
Reference in a new issue