Browse Source

fix: application crash when re-indexing an MD graph

fixes https://github.com/logseq/db-test/issues/266
Tienson Qin 7 tháng trước cách đây
mục cha
commit
a6225e435a
2 tập tin đã thay đổi với 11 bổ sung10 xóa
  1. 7 7
      src/main/frontend/components/journal.cljs
  2. 4 3
      src/main/frontend/util.cljc

+ 7 - 7
src/main/frontend/components/journal.cljs

@@ -20,13 +20,13 @@
 (defn- sub-journals
   []
   (when-let [repo (state/get-current-repo)]
-    (-> (react/q repo
-                 [:frontend.worker.react/journals]
-                 {:query-fn (fn [_]
-                              (p/let [{:keys [data]} (views/<load-view-data nil {:journals? true})]
-                                (remove nil? data)))}
-                 nil)
-        util/react)))
+    (some-> (react/q repo
+                     [:frontend.worker.react/journals]
+                     {:query-fn (fn [_]
+                                  (p/let [{:keys [data]} (views/<load-view-data nil {:journals? true})]
+                                    (remove nil? data)))}
+                     nil)
+            util/react)))
 
 (rum/defc all-journals < rum/reactive db-mixins/query
   []

+ 4 - 3
src/main/frontend/util.cljc

@@ -828,9 +828,10 @@
 #?(:cljs
    (defn react
      [ref]
-     (if rum/*reactions*
-       (rum/react ref)
-       @ref)))
+     (when ref
+       (if rum/*reactions*
+         (rum/react ref)
+         @ref))))
 
 #?(:cljs
    (def time-ms common-util/time-ms))