You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Undo of deleting 2 blocks fails and clears the history when one's node property points at the other #1331
On a page, type 2 blocks, "first" and "second" below it.
On "first", add a property of type node (for example "related") and set it to the block "second".
Select both blocks (click "first", Shift+click "second") and press Delete.
Press Ctrl+Z.
Expected
Both blocks are back, and "first" has "related" set to "second".
Actual
Nothing comes back, and the undo history is gone: another Ctrl+Z does nothing, not even undo the property from step 2. The worker logs Nothing found for entity id [:block/uuid <uuid of "second">].
If "second" holds the property pointing at "first" instead, the undo works.
Cause
The undo inverse of a delete (build-inverse-delete-blocks in deps/outliner/src/logseq/outliner/op/construct.cljc) restores each selected block with its own :insert-blocks op, in turn. Each block's payload holds its ref values as [:block/uuid ...] (build-insert-block-payload, sanitize-ref-value), so the op that restores "first" looks up "second" before the next op has inserted it, and throws. The failed history action then clears the history (apply-history-action in src/main/frontend/worker/undo_redo.cljs: a result that is neither applied nor skippable runs clear-history!).
Found by the property test of logseq/logseq#13461 (seed 777) and replayed on upstream master 16c4ed1a0 with 2 sibling blocks: holder above target fails with the error above, the history empty after it; holder below target restores both. The same with the app's worker transaction pipeline registered. A target inside the other selected block's subtree (a child of it) fails the same way. On the branch of logseq/logseq#13466 (undo from DataScript's record on graphs without sync) all 4 cases restore both blocks and the property value.
Activity
tiensonqin commentedon Sep 30, 2026
Fixed by logseq/logseq#13458, which has been merged into master. Closing as completed.