Browse Source

fix(cli): import-edn of in-app graph hangs

for unexpected transact error. Encountered this while repro-ing
https://github.com/logseq/db-test/issues/549. Also fixes UI not
displaying any notification
Gabriel Horner 1 week ago
parent
commit
4f5f68d0ab
1 changed files with 6 additions and 2 deletions
  1. 6 2
      deps/outliner/src/logseq/outliner/op.cljs

+ 6 - 2
deps/outliner/src/logseq/outliner/op.cljs

@@ -161,8 +161,12 @@
     ;; (cljs.pprint/pprint _txs)
     (if error
       (reset! *result {:error error})
-      (ldb/transact! conn (vec (concat init-tx block-props-tx misc-tx))
-                     (merge {::sqlite-export/imported-data? true} tx-meta)))))
+      (try
+        (ldb/transact! conn (vec (concat init-tx block-props-tx misc-tx))
+                       (merge {::sqlite-export/imported-data? true} tx-meta))
+        (catch :default e
+          (js/console.error "Unexpected Import EDN error:" e)
+          (reset! *result {:error (str "Unexpected Import EDN error: " (pr-str (ex-message e)))}))))))
 
 (defn ^:large-vars/cleanup-todo apply-ops!
   [repo conn ops date-formatter opts]