0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-05 05:49:07 -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/of (shapes-changes-persisted-finished))))))
(rx/catch (fn [cause] (rx/catch (fn [cause]
(rx/concat (cond
(if (= :authentication (:type cause)) (= :authentication (:type cause))
(rx/empty) (rx/throw cause)
(rx/of (rt/assign-exception 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 ;; Event to be thrown after the changes have been persisted
(defn shapes-changes-persisted-finished (defn shapes-changes-persisted-finished

View file

@ -66,7 +66,8 @@
(defmethod ptk/handle-error :default (defmethod ptk/handle-error :default
[error] [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" (print-group! "Unhandled Error"
(fn [] (fn []
(print-trace! error) (print-trace! error)

View file

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