Skip to content

fix: remove page from recent list after deletion - #13008

Closed
dannyinit wants to merge 1 commit into
logseq:masterfrom
dannyinit:fix/recent-pages-not-removed-after-delete
Closed

fix: remove page from recent list after deletion#13008
dannyinit wants to merge 1 commit into
logseq:masterfrom
dannyinit:fix/recent-pages-not-removed-after-delete

Conversation

@dannyinit

Copy link
Copy Markdown

Fixes #12988

What is the problem?
When a page is deleted, it's moved to the Recycle Bin, but it stays in the "Recent" list in the left sidebar. Clicking it there shows "Cannot go to an internal page" (or in the current version, a "Node has been moved to Recycle" message), instead of the page just being removed from the list.

How does this PR fix it?
Deleting a page already has a cleanup step for Favorites (<db-unfavorite-page!), but the same cleanup was never added for Recent pages. Added a remove-page-from-recent! function in frontend.state that filters a given page id out of the stored recent-pages list, and call it from the "Delete page" success handler in page_menu.cljs, right where the page is already deleted successfully.

I also tried wiring this into the existing after-page-deleted!/:page/deleted event flow (which already handles Favorites cleanup), but found that the page name carried in that event's tx-meta is dropped by the time it reaches the main thread, because apply-ops! batches all ops in a transaction under one shared tx-meta before it's sent to the listener. Doing the cleanup directly in the UI action handler (where the page entity is already in scope) avoids depending on that.

Tested manually: create a page, open it so it shows in Recent, delete it via the "..." menu, and confirm it's removed from Recent right away.

Note: I used Claude Code to help investigate the root cause and write this fix. I manually tested the described behavior myself on a local build before opening this PR.

@tiensonqin
tiensonqin requested review from tiensonqin and a balanced review from Copilot August 11, 2026 09:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes deleted pages from the sidebar’s persisted Recent list.

Changes:

  • Adds a helper to remove a page ID from recent history.
  • Invokes it after successful page deletion.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/main/frontend/state.cljs Adds recent-page removal and persistence.
src/main/frontend/components/page_menu.cljs Cleans Recent after deletion.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

[page]
(page-handler/<delete! (:block/uuid page)
(fn []
(state/remove-page-from-recent! (:db/id page))

(defn remove-page-from-recent!
[page-id]
(set-recent-pages! (vec (remove #{page-id} (get-recent-pages)))))
@tiensonqin

Copy link
Copy Markdown
Contributor

Addressed by #13014.

@tiensonqin tiensonqin closed this Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When deleting a page, it's still in the Recent list on the left side in the menu, when clicked it gives an error.

3 participants