Skip to content

Undo of deleting a tag leaves references to it as plain text #1310

Open
logseq/logseq
#13786

Description

@yuxi-liu-wired

Steps

  1. Create a tag "Movie".
  2. In a block, type watch [[Movie]].
  3. Delete the tag "Movie". The block now reads "watch Movie" as plain text.
  4. Press Ctrl+Z.

Expected

"Movie" is back, and the block reads "watch [[Movie]]" with its link to "Movie" again.

Actual

"Movie" is back, but the block still reads "watch Movie" as plain text, with no reference to "Movie".

Notes

Deleting a tag also rewrites the references to it in other blocks' titles into plain text. The undo restores the tag page but not those rewrites. Same family as #1304 and #1305: the undo of a delete does not restore what the delete changed on other nodes.

Found with a probe of undo on single operations, replayed on upstream master 16c4ed1a0: before the delete the block's raw title is watch [[<Movie's uuid>]] with Movie in its refs; after the undo it is watch Movie with no refs.

Activity

  1. yuxi-liu-wired commented on Sep 26, 2026

    @yuxi-liu-wired
    Author

    The same happens when the deleted node is a property or a plain page, not only a tag. Replayed on master 16c4ed1a0 with the undo property test of logseq/logseq#13461:

    Deleted node Block before the delete Block after Ctrl+Z
    tag "beta" edit [[beta]], ref to beta edit beta, no ref
    property "note" edit [[note]], ref to note edit note, no ref
    page "page 2" edit [[page 2]], ref to page 2 edit page 2, no ref

    All 3 go through :delete-page: build-page-retract-tx (deps/outliner/src/logseq/outliner/page.cljs) calls db-refs->page for any page, tag or property, which rewrites each linking block's title to plain text and retracts its ref, and the undo does not restore either.

  2. 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 tag now replays the delete's recorded datoms, so a block that read watch [[Movie]] gets its link back instead of plain text. local-graph-undo-of-tag-delete-restores-inline-references-test pins it (the raw title and the ref to Movie are both restored). 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