Skip to content

Commit 97e8140

Browse files
committed
fix: invalid db when creating nested page in Library
fixes logseq/db-test#554
1 parent 3bf78ac commit 97e8140

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/frontend/worker/pipeline.cljs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,14 @@
183183
page-tag-update? (and (= :block/tags (:a datom))
184184
(= (:db/id page-tag) (:v datom)))
185185
move-to-library? (and (= :block/parent (:a datom))
186-
(= (:db/id library-page) (:v datom))
186+
(or (= (:db/id library-page) (:v datom))
187+
(and
188+
(ldb/page? (d/entity db (:v datom)))
189+
(let [parents (->> (ldb/get-block-parents db (:block/uuid (d/entity db (:v datom))))
190+
(map :db/id)
191+
(set))]
192+
(contains? parents (:db/id library-page)))))
193+
187194
(:added datom))]
188195
(when (or page-tag-update? move-to-library?)
189196
(let [block-before (d/entity db-before id)

0 commit comments

Comments
 (0)