Skip to content

fix(ag-grid): DH-21775: restore rows after clearing a filter that returned zero rows#1328

Merged
mofojed merged 3 commits intodeephaven:mainfrom
mofojed:DH-21775-ag-grid-restore-row-clear-filter
Apr 8, 2026
Merged

fix(ag-grid): DH-21775: restore rows after clearing a filter that returned zero rows#1328
mofojed merged 3 commits intodeephaven:mainfrom
mofojed:DH-21775-ag-grid-restore-row-clear-filter

Conversation

@mofojed
Copy link
Copy Markdown
Member

@mofojed mofojed commented Apr 6, 2026

Reset cached viewport in handleFilterChanged so refreshViewport
recalculates from the grid's current display indices. Without this,
a stale viewport (e.g. {0, -1} from a zero-row filter result) was
reused after clearing the filter, leaving the grid empty.

…urned zero rows

Reset cached viewport in handleFilterChanged so refreshViewport
recalculates from the grid's current display indices. Without this,
a stale viewport (e.g. {0, -1} from a zero-row filter result) was
reused after clearing the filter, leaving the grid empty.
@mofojed mofojed requested review from a team and Copilot April 6, 2026 18:53
@mofojed mofojed self-assigned this Apr 6, 2026
@mofojed mofojed requested review from dgodinez-dh and removed request for a team April 6, 2026 18:53
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

This PR fixes an AG Grid viewport caching edge case where clearing a filter that previously returned zero rows could leave the grid empty due to reusing a stale { firstRow: 0, lastRow: -1 } viewport.

Changes:

  • Reset the cached viewport in handleFilterChanged so refreshViewport() recomputes from the grid’s current displayed row indices.
  • Add a Jest unit test that reproduces the “0 rows then clear filter” scenario and asserts a valid viewport is requested afterward.
  • Add a Playwright e2e test to validate rows reappear after clearing a zero-result filter in the UI.

Reviewed changes

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

File Description
plugins/ag-grid/src/js/src/datasources/DeephavenViewportDatasource.ts Clears currentViewport on filter change to prevent stale {0,-1} reuse after filter reset.
plugins/ag-grid/src/js/src/datasources/DeephavenViewportDatasource.test.ts New unit test covering filter→zero rows→clear filter viewport recalculation behavior.
tests/ag_grid.spec.ts New Playwright test exercising the regression via the AG Grid filter UI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugins/ag-grid/src/js/src/datasources/DeephavenViewportDatasource.test.ts Outdated
dgodinez-dh
dgodinez-dh previously approved these changes Apr 6, 2026
Copy link
Copy Markdown
Contributor

@dgodinez-dh dgodinez-dh left a comment

Choose a reason for hiding this comment

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

Looks fine, but there are some failures in the test file.

…urce.test.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mofojed mofojed merged commit 68bdb98 into deephaven:main Apr 8, 2026
16 checks passed
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