chore: With an empty collection we should show 0-0 instead of 1-1 VSCODE-771#1295
Open
tculig wants to merge 1 commit intomongodb-js:mainfrom
Open
chore: With an empty collection we should show 0-0 instead of 1-1 VSCODE-771#1295tculig wants to merge 1 commit intomongodb-js:mainfrom
tculig wants to merge 1 commit intomongodb-js:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes pagination range display for cursor (non-basic) queries so that an empty result set shows 0-0 instead of an invalid-looking 1-1, addressing VSCODE-771.
Changes:
- Update cursor-query pagination calculation to set
startItem/endItemto0when no documents are returned. - Adjust and extend reducer tests to assert
0-0for empty cursor-query results (including page 1).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/views/data-browsing-app/store/documentQuerySlice.ts |
Updates cursor-query pagination computation to return 0-0 for empty displayedDocuments. |
src/test/suite/views/data-browsing-app/documentQuerySlice.test.tsx |
Updates/adds tests to cover the new 0-0 behavior for empty cursor-query pages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
397
to
+401
|
|
||
| const result = reducer(pageTwoCursorState, documentsReceived(docs)); | ||
|
|
||
| expect(result.startItem).to.equal(11); | ||
| expect(result.endItem).to.equal(11); | ||
| expect(result.startItem).to.equal(0); | ||
| expect(result.endItem).to.equal(0); |
There was a problem hiding this comment.
The surrounding test case description (the it(...) label just above this block) no longer matches what is being asserted after the change to 0-0 for empty results. Please update the test name (or the setup) so the description reflects the empty-documents cursor-query scenario being tested.
Anemy
approved these changes
Mar 30, 2026
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.
Description
Ticket: https://jira.mongodb.org/browse/VSCODE-771
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes