Skip to content

Commit 4494e98

Browse files
committed
fix: parentRef cant be null
1 parent 44b35cb commit 4494e98

File tree

8 files changed

+11
-16
lines changed

8 files changed

+11
-16
lines changed

src/components/PaginatedTable/PaginatedTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface PaginatedTableProps<T, F> {
3535
columns: Column<T>[];
3636
getRowClassName?: GetRowClassName<T>;
3737
rowHeight?: number;
38-
parentRef: React.RefObject<HTMLElement> | null;
38+
parentRef: React.RefObject<HTMLElement>;
3939
initialSortParams?: SortParams;
4040
onColumnsResize?: HandleTableColumnsResize;
4141
renderControls?: RenderControls;

src/components/PaginatedTable/useScrollBasedChunks.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {throttle} from 'lodash';
55
import {calculateElementOffsetTop} from './utils';
66

77
interface UseScrollBasedChunksProps {
8-
parentRef: React.RefObject<HTMLElement> | null;
8+
parentRef: React.RefObject<HTMLElement>;
99
tableRef: React.RefObject<HTMLElement>;
1010
totalItems: number;
1111
rowHeight: number;
@@ -82,16 +82,11 @@ export const useScrollBasedChunks = ({
8282
}, [handleScroll, parentRef]);
8383

8484
return React.useMemo(() => {
85-
const activeChunkIds = Array.from(
86-
{length: endChunk - startChunk + 1},
87-
(_, i) => startChunk + i,
88-
);
89-
9085
// Create boolean array where true represents active chunks
9186
const activeChunks = Array(chunksCount).fill(false);
92-
activeChunkIds.forEach((id) => {
93-
activeChunks[id] = true;
94-
});
87+
for (let i = startChunk; i <= endChunk; i++) {
88+
activeChunks[i] = true;
89+
}
9590

9691
return activeChunks;
9792
}, [endChunk, startChunk, chunksCount]);

src/containers/Nodes/NodesWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {PaginatedNodes} from './PaginatedNodes';
88
interface NodesWrapperProps {
99
path?: string;
1010
database?: string;
11-
parentRef: React.RefObject<HTMLElement> | null;
11+
parentRef: React.RefObject<HTMLElement>;
1212
additionalNodesProps?: AdditionalNodesProps;
1313
}
1414

src/containers/Nodes/PaginatedNodes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const b = cn('ydb-nodes');
4444
interface NodesProps {
4545
path?: string;
4646
database?: string;
47-
parentRef: React.RefObject<HTMLElement> | null;
47+
parentRef: React.RefObject<HTMLElement>;
4848
additionalNodesProps?: AdditionalNodesProps;
4949
}
5050

src/containers/Storage/PaginatedStorage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface PaginatedStorageProps {
1212

1313
viewContext: StorageViewContext;
1414

15-
parentRef: React.RefObject<HTMLElement> | null;
15+
parentRef: React.RefObject<HTMLElement>;
1616

1717
initialEntitiesCount?: number;
1818
}

src/containers/Storage/StorageGroups/PaginatedStorageGroupsTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface PaginatedStorageGroupsTableProps {
3232
visibleEntities: VisibleEntities;
3333
onShowAll: VoidFunction;
3434

35-
parentRef: React.RefObject<HTMLElement> | null;
35+
parentRef: React.RefObject<HTMLElement>;
3636
renderControls?: RenderControls;
3737
renderErrorMessage: RenderErrorMessage;
3838
initialEntitiesCount?: number;

src/containers/Storage/StorageNodes/PaginatedStorageNodesTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface PaginatedStorageNodesTableProps {
2929
nodesUptimeFilter: NodesUptimeFilterValues;
3030
onShowAll: VoidFunction;
3131

32-
parentRef: React.RefObject<HTMLElement> | null;
32+
parentRef: React.RefObject<HTMLElement>;
3333
renderControls?: RenderControls;
3434
renderErrorMessage: RenderErrorMessage;
3535
initialEntitiesCount?: number;

src/containers/Storage/StorageWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface StorageWrapperProps {
1111
pDiskId?: string | number;
1212
groupId?: string | number;
1313
vDiskSlotId?: string | number;
14-
parentRef: React.RefObject<HTMLElement> | null;
14+
parentRef: React.RefObject<HTMLElement>;
1515
}
1616

1717
export const StorageWrapper = ({parentRef, ...props}: StorageWrapperProps) => {

0 commit comments

Comments
 (0)