Selaa lähdekoodia

Merge branch 'feat/db' of https://github.com/logseq/logseq into feat/db

charlie 1 vuosi sitten
vanhempi
sitoutus
58167f0bc4
1 muutettua tiedostoa jossa 8 lisäystä ja 5 poistoa
  1. 8 5
      src/main/frontend/worker/file/page_rename.cljs

+ 8 - 5
src/main/frontend/worker/file/page_rename.cljs

@@ -94,11 +94,14 @@
 
 (defn- rename-update-block-refs!
   [refs from-id to-id]
-  (->> refs
-       (remove #{{:db/id from-id}})
-       (cons {:db/id to-id})
-       (distinct)
-       (vec)))
+  (if to-id
+    (->> refs
+        (remove #{{:db/id from-id}})
+        (cons {:db/id to-id})
+        (distinct)
+        (vec))
+    ;; New page not exists so that we keep using the old page's block as a ref
+    refs))
 
 (defn replace-page-ref
   "Unsanitized only"