Skip to content

feat(crud): persist document view COMPASS-6937#8168

Open
mabaasit wants to merge 4 commits into
mainfrom
COMPASS-6937-persist-last-open-documents-view
Open

feat(crud): persist document view COMPASS-6937#8168
mabaasit wants to merge 4 commits into
mainfrom
COMPASS-6937-persist-last-open-documents-view

Conversation

@mabaasit

Copy link
Copy Markdown
Collaborator

Description

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • If this change could impact the load on the MongoDB cluster, please describe the expected and worst case impact
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

Copilot AI review requested due to automatic review settings June 23, 2026 09:45
@mabaasit mabaasit marked this pull request as ready for review June 23, 2026 09:48
@mabaasit mabaasit requested a review from a team as a code owner June 23, 2026 09:48
@mabaasit mabaasit requested a review from alenakhineika June 23, 2026 09:48

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 persistence for the selected Documents view (List/JSON/Table) so new CRUD tabs and app restarts restore the user’s last chosen view.

Changes:

  • Introduces a DOCUMENT_VIEW_STORAGE_KEY and reads an initial document view from localStorage when initializing the CRUD store.
  • Persists document view changes to localStorage on viewChanged().
  • Extends the CRUD store test suite to cover the persistence behavior and improves some typings/casts.

Reviewed changes

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

File Description
packages/compass-crud/src/stores/crud-store.ts Adds a persisted document view key, initial view loading from localStorage, and stores view changes.
packages/compass-crud/src/stores/crud-store.spec.ts Adds/adjusts tests around view persistence and minor typing improvements.

Comment on lines +1734 to +1739
fakeGetItem = sinon.fake((key: string) => {
return localStorageValues[key];
});
fakeSetItem = sinon.fake((key: string, value: any) => {
localStorageValues[key] = value.toString();
});
Comment thread packages/compass-crud/src/stores/crud-store.spec.ts
Comment on lines +264 to +268
/**
* The key we use to persist the user selected document view for other tabs or
* for the next application start.
* Exported only for test purpose
*/
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Anemy Anemy changed the title COMPASS-6937: Persist document view feat(crud): persist document view COMPASS-6937 Jun 23, 2026
@github-actions github-actions Bot added the feat label Jun 23, 2026
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.

3 participants