0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-27 00:49:28 -05:00

Improve connection errors handling on workspace save operation

This commit is contained in:
Andrey Antukh 2023-07-25 12:52:47 +02:00
parent 9a60ac477f
commit bec09fb5d1
3 changed files with 16 additions and 6 deletions

View file

@ -182,11 +182,19 @@
(rx/of (shapes-changes-persisted-finished))))))
(rx/catch (fn [cause]
(rx/concat
(if (= :authentication (:type cause))
(rx/empty)
(rx/of (rt/assign-exception cause)))
(rx/throw cause)))))))))
(cond
(= :authentication (:type cause))
(rx/throw cause)
(instance? js/TypeError cause)
(->> (rx/timer 2000)
(rx/map (fn [_]
(persist-changes file-id file-revn changes pending-commits))))
:else
(rx/concat
(rx/of (rt/assign-exception cause))
(rx/throw cause))))))))))
;; Event to be thrown after the changes have been persisted
(defn shapes-changes-persisted-finished

View file

@ -66,7 +66,8 @@
(defmethod ptk/handle-error :default
[error]
(ts/schedule #(st/emit! (rt/assign-exception (::instance error))))
(when-let [cause (::instance error)]
(ts/schedule #(st/emit! (rt/assign-exception cause))))
(print-group! "Unhandled Error"
(fn []
(print-trace! error)

View file

@ -142,6 +142,7 @@
(mf/with-effect [theme]
(dom/set-html-theme-color theme))
[:& (mf/provider ctx/current-route) {:value route}
[:& (mf/provider ctx/current-profile) {:value profile}
(if edata