fix: remove page from recent list after deletion - #13008
Closed
dannyinit wants to merge 1 commit into
Closed
Conversation
tiensonqin
requested review from
tiensonqin
and
a balanced review from Copilot
August 11, 2026 09:45
Contributor
There was a problem hiding this comment.
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))))) |
Contributor
|
Addressed by #13014. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.