fix(databases): reset to page 1 when the table filter changes#1465
Open
dawsontoth wants to merge 1 commit into
Open
fix(databases): reset to page 1 when the table filter changes#1465dawsontoth wants to merge 1 commit into
dawsontoth wants to merge 1 commit into
Conversation
The database/table browser keeps its current page (offset) when a column filter is applied or cleared. On page 3+ (offset >= 40) a filter that matches fewer rows than the offset returns an empty page, so the list looks empty even though matches exist on page 1 (#1463). Add `appliedSearchConditions` to the `pageIndex` useEffectedState deps so the page resets to 0 whenever the applied filter changes — the same reset-on-dependency-change pattern the file already uses for sort, selectedIds, and pageIndex-on-table-change. This covers both the apply and clear paths (and any future path that mutates the applied filter). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates 'DatabaseTableView.tsx' to reset the table's page index to 0 whenever the applied search conditions change, preventing issues where a stale page offset results in empty query results. There are no review comments, so I have no feedback to provide.
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
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.
Problem
Fixes #1463.
In the database/table browser (
DatabaseTableView), the current page (offset) is not reset when a column filter is applied or cleared.pageIndexis translated straight intooffset: pageIndex * pageSizefor the search request, so if you're on page 3+ (offset ≥ 40) and apply a filter whose matches all live earlier, the server getsoffset: 40against a result set with fewer than 41 rows and returns an empty page — the list looks empty even though matches exist on page 1.Steps to reproduce
Fix
Add
appliedSearchConditionsto thepageIndexuseEffectedStatedependency list so the page resets to0whenever the applied filter changes:This is the same reset-on-dependency-change pattern the file already uses for
sort,selectedIds,wantExactCount, andpageIndex-on-table-change. Because it keys off the applied-filter state that actually drives the query, it covers both the apply and clear paths (applyFilters/clearFilters) and any future code path that mutates the applied filter — the reset can't be forgotten. It mirrors the existing imperative precedents (changePageSizeinTablePagination, and the org-listonFilterByNameChanged), which also reset the page to 0 on a window change.DatabaseTableViewis the only list view in the app with both server-side offset pagination and filtering that wasn't already resetting the page (the org list already handles it; logs/deployments/SimpleBrowseDataTable-based views don't use offset pagination).Testing
tsc -b— cleanoxlint— cleanvitest run— 1267 passed / 11 skipped (full suite; the 6 databases-feature test files pass)Browser verification of the exact flow deferred — will confirm together against real cluster data.
🤖 Generated with Claude Code