diff --git a/frontend/libs/studio-components/src/components/StudioTableLocalPagination/StudioTableLocalPagination.test.tsx b/frontend/libs/studio-components/src/components/StudioTableLocalPagination/StudioTableLocalPagination.test.tsx index 0d47ffd62be..3e226139344 100644 --- a/frontend/libs/studio-components/src/components/StudioTableLocalPagination/StudioTableLocalPagination.test.tsx +++ b/frontend/libs/studio-components/src/components/StudioTableLocalPagination/StudioTableLocalPagination.test.tsx @@ -135,6 +135,6 @@ describe('StudioTableLocalPagination', () => { emptyTableMessage='No rows to display' />, ); - expect(screen.getByRole('paragraph', { value: 'No rows to display' })).toBeInTheDocument(); + expect(screen.getByText('No rows to display')).toBeInTheDocument(); }); }); diff --git a/frontend/libs/studio-components/src/components/StudioTableLocalPagination/StudioTableLocalPagination.tsx b/frontend/libs/studio-components/src/components/StudioTableLocalPagination/StudioTableLocalPagination.tsx index 23893fd4844..f515200afc7 100644 --- a/frontend/libs/studio-components/src/components/StudioTableLocalPagination/StudioTableLocalPagination.tsx +++ b/frontend/libs/studio-components/src/components/StudioTableLocalPagination/StudioTableLocalPagination.tsx @@ -38,15 +38,15 @@ export const StudioTableLocalPagination = forwardRef< useEffect(() => { const newRowsToRender = getRowsToRender(currentPage, pageSize, sortedRows || rows); - const outOfRange = !newRowsToRender.length && currentPage > 1; - if (outOfRange) { + const isOutOfRange = !newRowsToRender.length && currentPage > 1; + if (isOutOfRange) { setCurrentPage(1); setRowsToRender(getRowsToRender(1, pageSize, sortedRows || rows)); return; } setRowsToRender(newRowsToRender); - }, [sortedRows, currentPage, pageSize]); + }, [sortedRows, rows, currentPage, pageSize]); const totalPages = Math.ceil(rows.length / pageSize); diff --git a/frontend/libs/studio-components/src/components/StudioTableRemotePagination/StudioTableRemotePagination.test.tsx b/frontend/libs/studio-components/src/components/StudioTableRemotePagination/StudioTableRemotePagination.test.tsx index faf6e9c263f..deb790a7af9 100644 --- a/frontend/libs/studio-components/src/components/StudioTableRemotePagination/StudioTableRemotePagination.test.tsx +++ b/frontend/libs/studio-components/src/components/StudioTableRemotePagination/StudioTableRemotePagination.test.tsx @@ -96,6 +96,6 @@ describe('StudioTableRemotePagination', () => { emptyTableMessage='No rows to display' />, ); - expect(screen.getByRole('paragraph', { value: 'No rows to display' })).toBeInTheDocument(); + expect(screen.getByText('No rows to display')).toBeInTheDocument(); }); });