Skip to content

Add support for recent documents - #7982

Draft
jtpio wants to merge 3 commits into
jupyter:mainfrom
jtpio:recents
Draft

Add support for recent documents#7982
jtpio wants to merge 3 commits into
jupyter:mainfrom
jtpio:recents

Conversation

@jtpio

@jtpio jtpio commented Jul 9, 2026

Copy link
Copy Markdown
Member

References

Fixes #1294

Code changes

  • Add a new tab with recent documents
  • Documentation
  • UI tests

User-facing changes

notebook-recents.mp4

Backwards-incompatible changes

None

@jtpio jtpio added this to the 7.7.0 milestone Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Binder 👈 Launch a Binder on branch jtpio/notebook/recents

@jtpio
jtpio force-pushed the recents branch 2 times, most recently from e415bc1 to d85ef95 Compare July 9, 2026 13:35

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

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: 1 leaves 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 null or objects without root/path into the cache. The getters and addRecent then 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';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Tab with recently opened notebooks

2 participants