debug: collect insert block timeout errors

This commit is contained in:
Tienson Qin
2025-09-16 19:39:52 +08:00
parent a71c8a938c
commit d0b433c82a
2 changed files with 15 additions and 9 deletions

View File

@@ -353,13 +353,19 @@
:block/name (util/page-name-sanity-lc (:block/title new-block)))
(dissoc :block/page)))
new-block)]
(ui-outliner-tx/transact!
{:outliner-op :insert-blocks}
(save-current-block! {:current-block current-block})
(outliner-op/insert-blocks! [new-block'] current-block {:sibling? sibling?
:keep-uuid? keep-uuid?
:ordered-list? ordered-list?
:replace-empty-target? replace-empty-target?}))))
(->
(ui-outliner-tx/transact!
{:outliner-op :insert-blocks}
(save-current-block! {:current-block current-block})
(outliner-op/insert-blocks! [new-block'] current-block {:sibling? sibling?
:keep-uuid? keep-uuid?
:ordered-list? ordered-list?
:replace-empty-target? replace-empty-target?}))
(p/timeout 2000)
(p/catch (fn [error]
(js/console.error error)
(state/pub-event! [:capture-error {:error error
:payload {:type :insert-block-timeout}}]))))))
(defn- block-self-alone-when-insert?
[config uuid]

View File

@@ -64,7 +64,6 @@
"NOTE: don't add more logic in this listener, use mobile-flows instead"
[^js state]
(println :debug :app-state-change-handler state (js/Date.))
(reset! mobile-flows/*mobile-app-state (.-isActive state))
(when (state/get-current-repo)
(let [is-active? (.-isActive state)]
(if (not is-active?)
@@ -79,7 +78,8 @@
500)
(p/catch (fn [error]
(js/console.error error)
(js/window.location.reload)))))))))
(js/window.location.reload))))))))
(reset! mobile-flows/*mobile-app-state (.-isActive state)))
(defn- general-init
"Initialize event listeners used by both iOS and Android"