Skip to content

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
tculig:VSCODE-771-empty-collection-display
Open

chore: With an empty collection we should show 0-0 instead of 1-1 VSCODE-771#1295
tculig wants to merge 1 commit intomongodb-js:mainfrom
tculig:VSCODE-771-empty-collection-display

Conversation

@tculig
Copy link
Copy Markdown
Contributor

@tculig tculig commented Mar 27, 2026

Description

Ticket: https://jira.mongodb.org/browse/VSCODE-771

Checklist

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 March 27, 2026 14:03
@tculig tculig requested a review from a team as a code owner March 27, 2026 14:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/endItem to 0 when no documents are returned.
  • Adjust and extend reducer tests to assert 0-0 for 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);
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants