Skip to content

Undo of deleting today's journal or a tag page fails and clears the history when a block's node property points at a later block #1379

Closed
logseq/logseq
#13528

Description

@yuxi-liu-wired

Steps

  1. On today's journal, type 2 blocks, "first" and "second" below it.
  2. On "first", add a property of type node (for example "related") and set it to the block "second".
  3. Delete the page (page menu, Delete).
  4. Press Ctrl+Z.

The same happens with a tag page: create a tag, type the 2 blocks on its page, set the property as in step 2, delete the tag, undo.

Expected

Both blocks are back, and "first" has "related" set to "second". For a tag page, the tag is back too.

Actual

Nothing comes back, and the undo history is gone: another Ctrl+Z does nothing. For a tag page, the tag itself stays deleted.

I reproduced this with the outliner ops that deleting a page sends ([:delete-page [page-uuid {}]], then the worker's undo) in frontend.worker.undo-redo-test on master e2ca31b90. I did not click through it in the app.

Cause

This is #1331 again, on another path. The undo inverse of a page delete (build-inverse-delete-page in deps/outliner/src/logseq/outliner/op/construct.cljc) restores the top-level blocks of today's journal, or of a tag or property page, with 1 :insert-blocks op each. A block's payload holds its ref values as [:block/uuid ...] lookups, so the op that restores "first" looks up "second" before the next op has inserted it, and throws "Nothing found for entity id". The failed history action then clears the history (apply-history-action in src/main/frontend/worker/undo_redo.cljs). logseq/logseq#13458 fixed the block-delete inverse (build-inverse-delete-blocks) by setting such refs after all inserts; the 2 page-delete branches do not go through that step. The review of logseq/logseq#13458 pointed this out.

Activity

  1. tiensonqin commented on Sep 30, 2026

    @tiensonqin
    Contributor

    Fixed by logseq/logseq#13528, which has been merged into master. Closing as completed.

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