Browse Source

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

charlie 1 year ago
parent
commit
58167f0bc4
1 changed files with 8 additions and 5 deletions
  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!
 (defn- rename-update-block-refs!
   [refs from-id to-id]
   [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
 (defn replace-page-ref
   "Unsanitized only"
   "Unsanitized only"