-
Notifications
You must be signed in to change notification settings - Fork 14
fix: table is not scrolled to top on sorting #2347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 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
onSort
callback toTableWithControlsLayout.Table
that triggers scroll-to-top after sorting. - Updated container components (
Tenants
,TabletsTable
, grouped storage/nodes components) to passonSort
and reset sort state per group. - Refactored
PaginatedTableWithLayout
to 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
handleSort
correctly invokesonSort
and then scrolls the table. Consider adding a unit or integration test for this behavior.
const handleSort = React.useCallback(
src/components/TableWithControlsLayout/TableWithControlsLayout.tsx
Outdated
Show resolved
Hide resolved
src/containers/Storage/PaginatedStorageNodes/GroupedStorageNodesComponent.tsx
Show resolved
Hide resolved
Actually I dont like current approach with onSort passing to table will rework here |
stand redeployed |
@artemmufazalov check again please - removed children-function approach in favor of unified scrollDependencies approach |
src/containers/Tenants/Tenants.tsx
Outdated
@@ -70,6 +70,9 @@ export const Tenants = ({additionalTenantsProps, scrollContainerRef}: TenantsPro | |||
); | |||
const loading = isFetching && currentData === undefined; | |||
|
|||
// Track sort state for scroll dependencies | |||
const [sortParams, setSortParams] = React.useState<any>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<SortOrder | SortOrder[] | undefined>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
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