@@ -48,7 +48,7 @@ import { MRT_Localization_ZH_HANS } from 'material-react-table/locales/zh-Hans';
4848import { MRT_Localization_ZH_HANT } from 'material-react-table/locales/zh-Hant' ;
4949import { memo , ReactNode , useEffect , useMemo , useState } from 'react' ;
5050import { useTranslation } from 'react-i18next' ;
51- import { getTablesRowsPerPage } from '../../../helpers/tablesRowsPerPage' ;
51+ import { getTablesRowsPerPage , setTablesRowsPerPage } from '../../../helpers/tablesRowsPerPage' ;
5252import { useShortcut } from '../../../lib/useShortcut' ;
5353import { useURLState } from '../../../lib/util' ;
5454import { useSettings } from '../../App/Settings/hook' ;
@@ -203,7 +203,7 @@ export default function Table<RowItem extends Record<string, any>>({
203203
204204 const storeRowsPerPageOptions = useSettings ( 'tableRowsPerPageOptions' ) ;
205205 const rowsPerPageOptions = rowsPerPage || storeRowsPerPageOptions ;
206- const defaultRowsPerPage = useMemo ( ( ) => getTablesRowsPerPage ( rowsPerPageOptions [ 0 ] ) , [ ] ) ;
206+ const defaultRowsPerPage = getTablesRowsPerPage ( rowsPerPageOptions [ 0 ] ) ;
207207 const [ pageSize , setPageSize ] = useURLState ( shouldReflectInURL ? 'perPage' : '' , {
208208 defaultValue : defaultRowsPerPage ,
209209 prefix,
@@ -272,6 +272,8 @@ export default function Table<RowItem extends Record<string, any>>({
272272 const pagination = updater ( { pageIndex : Number ( page ) - 1 , pageSize : Number ( pageSize ) } ) ;
273273 setPage ( pagination . pageIndex + 1 ) ;
274274 setPageSize ( pagination . pageSize ) ;
275+ // Persist the rows per page setting
276+ setTablesRowsPerPage ( pagination . pageSize ) ;
275277 } ,
276278 onGlobalFilterChange : setGlobalFilter ,
277279 renderToolbarInternalActions : props => {
0 commit comments