diff --git a/src/components/PaginatedTable/PaginatedTable.tsx b/src/components/PaginatedTable/PaginatedTable.tsx index b0e357d5e2..07e5c325ac 100644 --- a/src/components/PaginatedTable/PaginatedTable.tsx +++ b/src/components/PaginatedTable/PaginatedTable.tsx @@ -13,7 +13,6 @@ import type { PaginatedTableData, RenderEmptyDataMessage, RenderErrorMessage, - SortParams, } from './types'; import {useScrollBasedChunks} from './useScrollBasedChunks'; @@ -29,7 +28,6 @@ export interface PaginatedTableProps { getRowClassName?: GetRowClassName; rowHeight?: number; scrollContainerRef: React.RefObject; - initialSortParams?: SortParams; onColumnsResize?: HandleTableColumnsResize; renderEmptyDataMessage?: RenderEmptyDataMessage; renderErrorMessage?: RenderErrorMessage; @@ -50,7 +48,6 @@ export const PaginatedTable = ({ getRowClassName, rowHeight = DEFAULT_TABLE_ROW_HEIGHT, scrollContainerRef, - initialSortParams, onColumnsResize, renderErrorMessage, renderEmptyDataMessage, @@ -64,24 +61,6 @@ export const PaginatedTable = ({ const {sortParams, foundEntities} = tableState; - // Initialize state with props if available - React.useEffect(() => { - if (initialSortParams) { - setSortParams(initialSortParams); - } - - if (initialEntitiesCount) { - setTotalEntities(initialEntitiesCount); - setFoundEntities(initialEntitiesCount); - } - }, [ - setSortParams, - setTotalEntities, - setFoundEntities, - initialSortParams, - initialEntitiesCount, - ]); - const tableRef = React.useRef(null); const activeChunks = useScrollBasedChunks({ @@ -120,7 +99,7 @@ export const PaginatedTable = ({ [onDataFetched, setFoundEntities, setIsInitialLoad, setTotalEntities], ); - // Reset table on filters change + // Reset table on initialization and filters change React.useLayoutEffect(() => { const defaultTotal = initialEntitiesCount || 0; const defaultFound = initialEntitiesCount || 1;