Add support for recent documents - #7982
Draft
jtpio wants to merge 3 commits into
Draft
Conversation
Contributor
jtpio
force-pushed
the
recents
branch
2 times, most recently
from
July 9, 2026 13:35
e415bc1 to
d85ef95
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds persistent recent-document history to Notebook, exposed through the tree view and File menu.
Changes:
- Implements local-storage-backed recent document tracking.
- Adds the Recents tab, Open Recent menu integration, styling, and documentation.
- Adds end-to-end tests for listing, reopening, refreshing, clearing, and forgetting entries.
Reviewed changes
Copilot reviewed 11 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
app/package.json |
Enables the recent-documents menu plugin. |
CHANGELOG.md |
Updates a historical CVE link. |
docs/source/_static/images/recents.png |
Adds the Recents UI screenshot. |
docs/source/recents.md |
Documents recent-document behavior and configuration. |
docs/source/user-documentation.md |
Adds the new documentation page to navigation. |
notebook/app.py |
Exposes the server root to frontend configuration. |
packages/docmanager-extension/package.json |
Adds settings and translation dependencies. |
packages/docmanager-extension/src/index.ts |
Implements persistence and recent-document commands. |
packages/tree-extension/package.json |
Adds dependencies for the Recents panel. |
packages/tree-extension/src/index.ts |
Adds the Recents tree tab and item actions. |
packages/tree-extension/style/base.css |
Styles recent-document timestamps. |
ui-tests/test/recents.spec.ts |
Tests recent-document workflows. |
yarn.lock |
Updates dependency resolutions. |
Suppressed comments (2)
packages/docmanager-extension/src/index.ts:245
- Parent directories consume the same bounded list even though this PR filters them out of every user-facing Recents view. Since the document manager records the document and then its parent,
maxNumberRecents: 1leaves only the hidden directory and shows zero recent documents; larger limits similarly retain fewer documents than configured. Exclude directory records before applying the document quota.
recents[event] = list.slice(0, this._maxRecentsLength);
packages/docmanager-extension/src/index.ts:449
- Checking only that these values are arrays lets malformed entries such as
nullor objects withoutroot/pathinto the cache. The getters andaddRecentthen dereference those entries, so one valid-JSON but invalid local-storage value can break recent tracking on every page until storage is manually cleared. Validate each persisted item before accepting it.
const data = JSON.parse(raw);
recents = {
opened: Array.isArray(data.opened) ? data.opened : [],
closed: Array.isArray(data.closed) ? data.closed : [],
};
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| * tree page (or switching to the Recents tab) always reflects what the other | ||
| * pages have recorded. | ||
| */ | ||
| const RECENTS_STORAGE_KEY = '@jupyter-notebook/docmanager:recents'; |
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.
References
Fixes #1294
Code changes
User-facing changes
notebook-recents.mp4
Backwards-incompatible changes
None