fix: stop orphaning :default property value blocks - #13063
Open
tiensonqin wants to merge 2 commits into
Open
Conversation
Reuse an exclusive :default/:url value block on string updates, and reclaim unreferenced generated value blocks when set/batch-set replace the previous value. Three successive writes now leave one child. Fixes logseq/db-test#1073 Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
tiensonqin
marked this pull request as ready for review
August 18, 2026 07:24
tiensonqin
force-pushed
the
logseq/fix-default-property-value-orphans-ef64
branch
from
August 18, 2026 07:24
c724cf9 to
6a3f5f8
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes accumulation of orphaned generated property value blocks when updating cardinality-one :default / :url properties by reusing an exclusive existing value block for successive string updates and reclaiming now-unreferenced generated value blocks when values are replaced/removed (aligning behavior with batch-remove-property!).
Changes:
- Reuse a block’s exclusive generated
:default/:urlvalue block and update its title in place, instead of minting a new value block per edit. - Reclaim generated property value blocks that become unreferenced after replace/remove operations (while preserving shared values like pages, closed values, empty placeholder, and configured default values).
- Add unit tests to ensure no orphaning occurs across
set-block-property!,batch-set-property!, entity replacement,:url, many-cardinality add vs replace, andremove-block-property!.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| deps/outliner/src/logseq/outliner/property.cljs | Adds reuse + safe reclamation logic for generated property value blocks during set/batch-remove paths. |
| deps/outliner/test/logseq/outliner/property_test.cljs | Adds regression coverage ensuring string updates don’t orphan generated value blocks and that removals reclaim unreferenced ones. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Updating a cardinality-one
:defaultor:urlproperty with a new string used to mint a new value block and only retract the old attribute ref. The previous value block stayed as an invisible child of the host (:logseq.property/created-from-property, unreferenced), so each edit accumulated another orphan.This change does two things in the outliner set/batch-set path:
batch-remove-property!.Shared values (closed values, pages, empty placeholder, a property's configured default value, and values still referenced by other blocks) are left alone. UI in-place title edits of the existing value block are unchanged.
Fixes logseq/db-test#1073
Tests
default-property-string-updates-do-not-orphan-value-blockscoveringset-block-property!,batch-set-property!, in-place title edits, entity replacement,:url, independent hosts, and many-cardinality add vs replace.remove-block-property!now asserts the unreferenced value block is deleted.deps/outlinerunit tests: 100 tests, 370 assertions, 0 failures.