-
Notifications
You must be signed in to change notification settings - Fork 15
fix: paginated table in groups scrolled to top on refresh #2291
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
13bd573
to
a5eb2ea
Compare
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 refactors paginated tables to use a scrollContainerRef
instead of parentRef
and introduces a context-based table state (PaginatedTableProvider
) along with automatic scroll adjustment (useTableScroll
). It also removes the old renderControls
props and centralizes control rendering via context consumers.
- Swap
parentRef
forscrollContainerRef
across table components - Introduce
PaginatedTableProvider
and remove per-component control rendering - Add
useTableScroll
hook and updateTableWithControlsLayout.Table
for sticky scroll adjustments
Reviewed Changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
src/containers/Storage/StorageNodes/getNodes.ts | Added mock generation path via URL params |
src/components/TableWithControlsLayout/useTableScroll.ts | New hook to sync table and container scrolling |
src/components/TableWithControlsLayout/TableWithControlsLayout.tsx | Updated Table component to use useTableScroll and refs |
src/components/PaginatedTable/ResizeablePaginatedTable.tsx | Added onStateChange prop (unused) |
src/components/PaginatedTable/PaginatedTable.tsx | Removed parentRef and moved to context for scroll handling |
Comments suppressed due to low confidence (1)
src/containers/Storage/StorageNodes/nodes.ts:25
- [nitpick] The callback parameter
Name
starts with an uppercase letter and may be confused with a type or class. Rename it toname
for consistency with JavaScript naming conventions.
return poolNames.slice(0, count).map((Name) => ({
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 standardizes scrolling behavior by replacing parentRef
with scrollContainerRef
, introduces automatic table scrolling on updates, and refactors paginated table state to use a React context.
- Replace all
parentRef
props withscrollContainerRef
to unify scroll logic. - Add
useTableScroll
hook and extendTableWithControlsLayout
for auto-scrolling and full-height support. - Refactor
PaginatedTable
to use a context provider for internal state, removing ad-hoc control rendering.
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/containers/Tablets/TabletsTable.tsx | Enable full-height layout to support new scroll behavior |
src/components/TableWithControlsLayout/useTableScroll.ts | New hook to handle scrolling the table into view |
src/components/TableWithControlsLayout/TableWithControlsLayout.tsx | Extend layout with fullHeight , scrollContainerRef , and dependencies |
src/components/PaginatedTable/types.ts | Update types: rename parentRef → scrollContainerRef , adjust render control signatures |
src/components/PaginatedTable/PaginatedTableContext.tsx | Introduce PaginatedTableProvider context for table state |
src/components/PaginatedTable/useScrollBasedChunks.ts | Rename hook prop to scrollContainerRef and update internal logic |
src/components/PaginatedTable/PaginatedTable.tsx | Refactor to use context, remove parentRef , and simplify rendering |
various containers (Storage* , Nodes* , Cluster.tsx , etc.) |
Replace parentRef with scrollContainerRef in paginated/table components |
Comments suppressed due to low confidence (3)
src/containers/Storage/StorageNodes/PaginatedStorageNodes.tsx:37
- [nitpick] Multiple
*ControlsWithTableState
components across containers share identical patterns. Consider extracting a generic higher-order component to avoid duplication and ease future updates.
function StorageNodesControlsWithTableState({
src/components/PaginatedTable/PaginatedTable.tsx:131
- The previous implementation scrolled the container to top on filter/reset via
parentRef.current.scrollTo(0,0)
. WithparentRef
removed, the table no longer resets scroll position on filter changes; consider invokingscrollContainerRef.current.scrollTo(0, 0)
after resetting state.
React.useLayoutEffect(() => {
src/components/TableWithControlsLayout/useTableScroll.ts:1
- The new
useTableScroll
hook controls critical scroll behavior but lacks dedicated unit tests. Consider adding tests to verify scroll adjustment logic under different table positions and dependency changes.
import React from 'react';
scrolls with small table leaves some extra pixels of cluster overview |
@Raubzeug moved pyramid to separate component stand redeployed |
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 fixes the issue where paginated tables in groups were not scrolled to the top on refresh by refactoring scrolling logic and updating component props.
- Replaces the old "parentRef" prop with the new "scrollContainerRef" across multiple components.
- Updates table layout and scroll behavior with the new useTableScroll hook and revised CSS variables.
- Introduces wrapper components (e.g., StorageNodesControlsWithTableState, StorageGroupGroup) and switches to PaginatedTableWithLayout for improved state management and scrolling.
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/containers/Storage/TableGroup/TableGroup.tsx | Refactored TableGroup to an arrow function and set displayName. |
src/containers/Storage/StorageNodes/PaginatedStorageNodesTable.tsx | Replaced parentRef with scrollContainerRef and removed renderControls. |
src/containers/Storage/StorageGroups/PaginatedStorageGroupsTable.tsx | Consistently updated prop names and types; similar changes as StorageNodes table. |
src/containers/Storage/PaginatedStorageNodes.tsx | Updated scroll container handling and introduced new wrapper components. |
src/containers/Storage/PaginatedStorageGroups.tsx | Similar scroll refactoring and integration with PaginatedTableWithLayout. |
Various files in Nodes, PDiskPage, Cluster, and Table component directories | Replaced parentRef with scrollContainerRef and updated scrolling behavior accordingly. |
src/components/TableWithControlsLayout | Introduced useTableScroll hook and updated layout styles. |
src/components/PaginatedTable/* | Updated types, context, and scroll handling logic to align with new naming and scrolling mechanisms. |
Comments suppressed due to low confidence (1)
src/components/PaginatedTable/types.ts:68
- Verify that the change to the RenderControls type signature (removing parameters) does not break any existing implementations that might rely on receiving control state parameters.
export type RenderControls = () => React.ReactNode;
splitted PaginatedStorageNodes and PaginatedStorageGroups to directories as they are totally uncomprehensible as single large files |
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 refactors table scrolling logic to support a unified scrollContainerRef
, replaces legacy parentRef
props, and integrates useTableScroll
for automatic scroll adjustments.
- Swapped
parentRef
forscrollContainerRef
across storage, nodes, cluster, and paginated table components - Introduced
useTableScroll
inTableWithControlsLayout.Table
and propagatedscrollDependencies
for automatic repositioning - Updated SCSS variables for sticky header offsets and added full-height support
Reviewed Changes
Copilot reviewed 67 out of 67 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/components/TableWithControlsLayout/TableWithControlsLayout.tsx | Added scrollContainerRef and useTableScroll integration |
src/components/TableWithControlsLayout/useTableScroll.ts | New hook to align tables within scroll containers |
src/components/PaginatedTable/PaginatedTable.tsx | Removed parentRef , adopted context state, reset logic updated |
src/components/PaginatedTable/useScrollBasedChunks.ts | Renamed parentRef → scrollContainerRef |
src/components/PaginatedTable/PaginatedTableWithLayout.tsx | New wrapper using PaginatedTableProvider and full-height support |
src/containers/Storage/... | Replaced parentRef with scrollContainerRef in all storage-related paginated components |
src/containers/Nodes/... | Updated to use scrollContainerRef in Nodes and NodesTable |
src/containers/Cluster/Cluster.tsx | Propagated scrollContainerRef to TabletsTable , Tenants , Nodes , and PaginatedStorage |
src/containers/PDiskPage/PDiskPage.tsx | Swapped parentRef for scrollContainerRef in <PaginatedStorage> invocation |
src/containers/Storage/PaginatedStorage.tsx | Renamed prop parentRef → scrollContainerRef |
src/containers/Storage/PaginatedStorageGroups/... | Updated all related components to use scrollContainerRef |
Comments suppressed due to low confidence (3)
src/components/PaginatedTable/PaginatedTable.tsx:128
- The manual scroll-to-top on filter or data refresh was removed; without calling
scrollContainerRef.current.scrollTo(0, 0)
, users may remain mid-scroll after updates. Consider addingscrollContainerRef?.current?.scrollTo(0, 0);
inside this effect to reset the viewport.
React.useLayoutEffect(() => {
src/containers/Storage/PaginatedStorageGroups/PaginatedStorageGroups.tsx:21
- [nitpick] There is a typo in the variable name
storageGroupsHandlerHasGroupping
(double 'p'). Please rename tostorageGroupsHandlerHasGrouping
for consistency and clarity.
const storageGroupsHandlerHasGroupping = useStorageGroupsHandlerHasGrouping();
src/components/TableWithControlsLayout/useTableScroll.ts:102
- The new scroll adjustment logic in
useTableScroll
lacks dedicated unit or integration tests. Consider adding tests that simulate container scroll and dependency changes to verify correct offset calculations and behavior.
React.useLayoutEffect(() => {
Screen.Recording.2025-05-21.at.09.36.19.mov |
@Raubzeug as for now all known issues should be fixed (your screencast too) Stand redeployed |
@Raubzeug conflicts resolved stand redeployed |
const {sortParams, foundEntities} = tableState; | ||
|
||
// Initialize state with props if available | ||
React.useEffect(() => { |
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.
Why not pass initialSortParams
and initialEntitiesCount
as part of initial state?
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.
good point!
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.
|
||
display: inline-block; | ||
|
||
box-sizing: border-box; | ||
min-width: 100%; | ||
|
||
&_fullHeight { |
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.
lets not use camel case in css
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
Stand
Closes #2200
CI Results
Test Status:⚠️ FLAKY
📊 Full Report
😟 No changes in tests. 😕
Bundle Size: 🔺
Current: 83.62 MB | Main: 83.59 MB
Diff: +0.04 MB (0.04%)
ℹ️ CI Information