fix: table is not scrolled to top on sorting#2347
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR ensures that tables reset their scroll position to the top when a sort action occurs, and it gives each grouped/paginated table its own independent sort state.
- Added an
onSortcallback toTableWithControlsLayout.Tablethat triggers scroll-to-top after sorting. - Updated container components (
Tenants,TabletsTable, grouped storage/nodes components) to passonSortand reset sort state per group. - Refactored
PaginatedTableWithLayoutto include sort parameters in its scroll dependencies for auto-scrolling.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/TableWithControlsLayout/TableWithControlsLayout.tsx | Added onSort prop and wrapping logic in the Table. |
| src/containers/Tenants/Tenants.tsx | Passed onSort through to the main table render. |
| src/containers/Tablets/TabletsTable.tsx | Passed onSort into the data table. |
| src/containers/Storage/**/Grouped*Component.tsx | Introduced PaginatedTableWithLayout with independent sort state per group. |
| src/containers/Nodes/PaginatedNodes/GroupedNodesComponent.tsx | Same grouping changes for node tables. |
| src/components/PaginatedTable/PaginatedTableWithLayout.tsx | Created TableWithAutoScrolling to wire sort state into scroll deps. |
Comments suppressed due to low confidence (1)
src/components/TableWithControlsLayout/TableWithControlsLayout.tsx:74
- No tests were added to verify that
handleSortcorrectly invokesonSortand then scrolls the table. Consider adding a unit or integration test for this behavior.
const handleSort = React.useCallback(
artemmufazalov
previously approved these changes
Jun 2, 2025
Collaborator
Author
|
Actually I dont like current approach with onSort passing to table will rework here |
Collaborator
Author
|
stand redeployed |
Collaborator
Author
|
@artemmufazalov check again please - removed children-function approach in favor of unified scrollDependencies approach |
artemmufazalov
suggested changes
Jun 3, 2025
| const loading = isFetching && currentData === undefined; | ||
|
|
||
| // Track sort state for scroll dependencies | ||
| const [sortParams, setSortParams] = React.useState<any>(); |
Member
There was a problem hiding this comment.
<SortOrder | SortOrder[] | undefined>?
artemmufazalov
approved these changes
Jun 3, 2025
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.
Closes #2345
Stand
Now on prod table is not scrolled to top on sorting at all
I suppose this to be severe bug
Here we scroll regular tables to top on sorting
Grouped tables on sorting scroll to top of specific group that is being sorted
Also on prod there is common sortParams for all tables (even if I sort only one group)
In this pr every group has independent sort params (as now every group has its own state)
CI Results
Test Status:⚠️ FLAKY
📊 Full Report
😟 No changes in tests. 😕
Bundle Size: 🔺
Current: 83.65 MB | Main: 83.65 MB
Diff: +5.65 KB (0.01%)
ℹ️ CI Information