Skip to content

Undo of deleting a property with choices sets the property's own value to a choice #1309

Open
logseq/logseq
#13786

Description

@yuxi-liu-wired

Steps

  1. Create a text property "stage" with 2 choices, "draft" and "done".
  2. Delete the property.
  3. Press Ctrl+Z.

Expected

The property "stage" is back with its 2 choices, and nothing holds a value of "stage".

Actual

The property is back with its choices, and the property's own page holds the value stage: done. No node held a value of "stage" before the delete.

Notes

The choices of a property are blocks on the property's page. The undo of :delete-page puts the page's blocks back, and inserting a block that is a property value also sets that value on the block's owner (insert-blocks in deps/outliner/src/logseq/outliner/core.cljs). That is a guess at the cause from reading the code; I have not traced it. #1304 is a different case with the same operation: undo of deleting a text property does not give back the values that blocks held.

Found with a property-based test of random outliner operation sequences with undo and redo ([[:delete-page 3 41 false]] in frontend.worker.outliner-undo-property-test, where page 3 is the property "stage"), on upstream master 16c4ed1a0.

Activity

  1. yuxi-liu-wired commented on Oct 27, 2026

    @yuxi-liu-wired
    Author

    Fixed on graphs without sync by logseq/logseq#13786. Undo of deleting a property now replays the delete's recorded datoms, so the property comes back with its choices and nothing holds a value of it. local-graph-undo-of-choice-property-delete-sets-no-value-test pins it (the choices are back and no datoms exist under the property's ident). A synced graph still undoes through the old inverse op, which this PR does not change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions