Repository navigation
fix(db): an edit deletes the empty page it no longer references - #13675
Closed
yuxi-liu-wired wants to merge 2 commits into
Closed
yuxi-liu-wired wants to merge 2 commits into
yuxi-liu-wired wants to merge 2 commits into
Conversation
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 11, 2026
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 13, 2026
yuxi-liu-wired
added a commit
to yuxi-liu-wired/logseq
that referenced
this pull request
Oct 16, 2026
Typing [[Brand new]] in a block creates the page Brand new; deleting the reference from the block again is meant to delete that page when it is empty and nothing else references it (remove-orphaned-page-refs! on save). It never did: get-orphaned-pages keeps a page with (:block/properties page), and in a DB graph every page's :block/properties holds its :block/tags (the Page or Journal tag), so no page ever qualified. Only properties other than :block/tags keep a page now.
With the cleanup working, a save that does not change the title (collapsing a block) must not take the block's pages for orphans: the cleanup runs only when the title changes.
yuxi-liu-wired
force-pushed
the
fix/orphaned-page-on-edit
branch
from
October 16, 2026 18:35
ba1068a to
7aa07ef
Compare
Contributor
Author
|
Combined with the other PRs that change the same files into #13786. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Typing
[[Brand new]]in a block creates the page "Brand new". Deleting that reference from the block again is meant to delete the page when it is empty and nothing else references it:save-blockcallsremove-orphaned-page-refs!for that. It never deletes anything.ldb/get-orphaned-pageskeeps a page that has(:block/properties page). In a DB graph,:block/properties(entity-plus/get-properties) lists every property attribute of the entity, and:block/tagsis one: every page has the Page (or Journal) tag, so every page has properties and none ever qualifies.The fix: only properties other than
:block/tagskeep a page.Test:
src/test/logseq/outliner/orphaned_pages_test.cljs. An edit from[[Kept]] [[Dropped]]to[[Kept]]deletes the empty page Dropped and keeps Kept (fails on master: Dropped stays); a page with a property (a checkbox set on it) is kept; a save without a title (collapsing the block) keeps the pages the block references, since the cleanup runs only when the title changes. The test is in the app's test build because the outliner library's nbb run does not compute:block/properties. The editor, undo/redo, page, outliner, pipeline and DB core test namespaces pass with the change.