Repository navigation
fix(delete): deleting a tag page turns refs to it into its title, also next to refs to its blocks - #13686
Closed
yuxi-liu-wired wants to merge 1 commit into
Closed
fix(delete): deleting a tag page turns refs to it into its title, also next to refs to its blocks#13686yuxi-liu-wired wants to merge 1 commit into
yuxi-liu-wired wants to merge 1 commit into
Conversation
…o next to refs to its blocks
yuxi-liu-wired
force-pushed
the
fix/delete-tag-page-refs
branch
from
October 16, 2026 18:35
ce72dbf to
43b481d
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.
Deleting a tag (or property) page leaves the deleted page's
[[uuid]]in any block that references the page next to one of the page's own blocks. Example: a block says "see [[Foo]] and [[fb]]", where Foo is a tag and fb a block on Foo's page. After deleting the tag Foo, the block readssee [[<Foo's uuid>]] and fb: a reference to a node that no longer exists, instead ofsee Foo and fb.Cause:
outliner-page/delete!sends the page's ref rewrite (the block's title with[[Foo]]turned into "Foo") and the retracts in one transaction.ldb/transact!then appendsdelete-blocks/update-refs-history, which writes the same block's title again, computed from its title before the transaction with only the retracted blocks replaced (fb); pages are notblock-entity?, so[[Foo]]stays. Two values for the cardinality-one:block/titlein one transaction: the later one wins. When the block references only the page, both rewrites agree, which is why the common case works.Fix:
build-retracted-txalso turns refs to pages retracted in the same transaction into their titles, so its rewrite agrees with the page's own. Which entities count as blocks (for expanding a delete to children) is unchanged.Test:
logseq.outliner.delete-tag-page-refs-test(app test build: the title rewrite reads:block/raw-title, an entity-plus lookup nbb does not have) deletes a tag page withoutliner-page/delete!and checks a block referencing the page and its block ("see Foo and fb") and a block referencing only the page ("see Foo"). On master it fails on the first; with the fix it passes. Also with the fix:logseq.db.common.delete-blocks-test,logseq.db-test(33 tests),logseq.outliner.page-test,logseq.outliner.property-test(56 tests) under nbb, andfrontend.worker.pipeline-test(45 tests, including page deletes) in the app build: 0 failures. Lint as in CI fordeps/dband the app.Found by mutation testing:
andtoorinblock-entity?made no existing test fail, and the changed version gave "see Foo and fb".