Skip to content

Restoring a page from the Recycle leaves the links to it as plain text #1349

Open

Description

@yuxi-liu-wired

Steps

  1. Create a page "Foo".
  2. On another page, type a block "see [[Foo]]".
  3. Open Foo's page menu and delete the page.
  4. Open the Recycle page and restore Foo.

Expected

The graph is as it was before step 3: the block reads "see [[Foo]]" with a working link, and Foo's Linked References list the block.

Actual

The block reads "see Foo", plain text, and Foo has no linked references. Restoring does not bring the link back.

Cause

Deleting an ordinary page (delete!, deps/outliner/src/logseq/outliner/page.cljs:144-155) rewrites every block that links to it: db-refs->page replaces the [[<uuid>]] in the block's text by the page's title as plain text (content-id-ref->page, deps/db/src/logseq/db/frontend/content.cljs:29-38) and retracts the block's ref to the page. The page itself goes to the Recycle. restore-tx-data (deps/outliner/src/logseq/outliner/recycle.cljs) moves the page back and retracts the recycle attributes, and nothing records or reverses the text rewrite.

db-test#1310 is the same rewrite seen through undo (of a tag delete); this is the Recycle's own restore of an ordinary page.

Found by the page model property test (frontend.worker.page-model-property-test, branch test/page-model-fuzz) on upstream master 16c4ed1a0, with the check "trash then restore is identity": the graph after the delete and the restore equals the graph before, apart from timestamps and the Recycle's own attributes. Shortest sequence: FUZZ_REPLAY='[[:create 0 0 0] [:link 0 0 0] [:trash 1 0 0]]'. The same difference shows with an unrelated edit between the delete and the restore, compared with that edit alone.

Activity

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

    @yuxi-liu-wired
    Author

    Still on current master (d06ded9971). Moving a page to the Recycle Bin runs delete!, which rewrites every [[uuid]] ref to the page as plain text (db-refs->page, deps/outliner/src/logseq/outliner/page.cljs:143-153); restoring only clears the recycle attributes (restore-tx-data in deps/outliner/src/logseq/outliner/recycle.cljs), so the links stay text.

    Two ways to fix it; which one is a maintainer's call:

    • (a) Do not rewrite refs when a page is only recycled. Refs to a recycled page already render struck through (block.cljs, around lines 855-874), and a permanent delete already turns refs into titles (delete_blocks.cljs). This reverses f819dc4242 ("fix: recycle page refs..."), which added the rewrite on purpose.
    • (b) Keep the rewrite, record which blocks were rewritten when the page is recycled, and turn them back into refs on restore.

    Happy to send a PR for either.

  2. JaredStemper commented on Nov 11, 2026

    @JaredStemper

    Confirmed on installed 2.0.2 / 533ac43 with a past journal page via native apply-outliner-ops: delete-page rewrites an incoming UUID link to plain date text; restore-recycled leaves both text and missing :block/refs unchanged. SQLite/EDN roundtrip controls preserve the original refs. Disposable no-sync fixture; actual GUI restore not exercised.

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