Skip to content

Undo of deleting a block turns its page links into links by name #1326

Open
logseq/logseq
#13786

Description

@yuxi-liu-wired

Steps

  1. Create a tag "Movie".
  2. In a block, type watch [[Movie]].
  3. Delete the block.
  4. Press Ctrl+Z.
  5. Rename the tag "Movie" to "Film".

Expected

The block reads "watch [[Film]]", as it does when step 3 and 4 are left out.

Actual

The block still reads "watch [[Movie]]", while its reference points at "Film". The undo put the block back with its link stored by the page's name, watch [[Movie]], where the block had stored it by the page's uuid, watch [[<uuid>]], so the link no longer follows the page.

Cause

The undo inverse of a delete builds the blocks to insert again with build-insert-block-payload (deps/outliner/src/logseq/outliner/op/construct.cljc), which copies :block/title from the deleted block's entity. On a DB graph an entity's :block/title is the display title: get-block-title in deps/db/src/logseq/db/common/entity_plus.cljc replaces the [[uuid]] of each page in the block's refs with [[page title]]. The stored title, with the uuids, is :block/raw-title.

Found with a property-based test of random outliner operation sequences with undo and redo, replayed on upstream master 16c4ed1a0: before the delete the block's raw title is edit [[<Movie's uuid>]]; after the undo it is edit [[Movie]], with Movie still in the block's refs. After renaming Movie to "Film", the restored block reads edit [[Movie]], and a block that was never deleted reads edit [[Film]]. The same replay with the app's worker transaction pipeline registered (ldb/register-transact-pipeline-fn! worker-pipeline/transact-pipeline) gives the same result.

Activity

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

    @yuxi-liu-wired
    Author

    Fixed in logseq/logseq#13786 (fix(db): sync checksum and local graphs, page and tag names, orphaned pages, tag deletion, recycled values, and unreachable code). Its description has the cause and the test that pins it; it fails on current master and passes with the fix.

  2. 1 remaining item

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