MUI X Data Grid shows the wrong page size or resets to page one
Data Grid shows all rows and has no pagination footerShort answer
Data Grid pagination breaks for four documented reasons: Pro and Premium need the pagination prop, the free grid caps pages at 100 rows, server mode needs paginationMode and a stable rowCount, and and autoPageSize cannot be combined with autoHeight. Check which one matches your setup.
Fix it fast
1Find out which cause you have
Find which grid package you import. The Community grid paginates by default; Pro and Premium do not.
grep -rn "@mui/x-data-grid" src/ package.json2Match what you see, then jump to its fix
- 1
All rows render and there is no footer.Pro or Premium grid without the pagination propFix - 2
You set a page size above 100 on the free grid and rows are still capped.Page size above 100 on the free gridFix - 3
Changing page does nothing, or the grid resets to page one after each fetch.Server pagination without paginationMode or a stable rowCountFix - 4
The grid collapses or shows an odd number of rows.autoPageSize combined with autoHeightFix
- 1
What does the error look like?
Data Grid shows all rows and has no pagination footerThe grid jumps back to page 1 while server data loads
Cause 1 of 4
Pro or Premium grid without the pagination prop
1Check
Pagination is off by default in the Pro and Premium grids.
grep -rn "DataGridPro\|DataGridPremium" src/2Fix
Add the pagination prop.
<DataGridPro pagination rows={rows} columns={columns} />3Verify
The footer with rows per page appears.
npm run devConfirmed by mui.com
Cause 2 of 4
Page size above 100 on the free grid
1Check
The MIT licensed grid is limited to pages of up to 100 rows.
grep -rn "pageSize" src/2Fix
Use a page size of 100 or less, or move to a Pro or Premium plan for larger pages.
<DataGrid
rows={rows}
columns={columns}
initialState={{ pagination: { paginationModel: { pageSize: 25, page: 0 } } }}
pageSizeOptions={[10, 25, 50, 100]}
/>3Verify
The footer shows 25 and the dropdown lists the options.
npm run devConfirmed by mui.com
Cause 3 of 4
Server pagination without paginationMode or a stable rowCount
1Check
Server mode needs paginationMode='server', a handler on onPaginationModelChange that fetches, and rowCount. If rowCount becomes undefined while loading, the page resets to zero.
grep -rn "rowCount\|paginationMode" src/2Fix
Control the model, set server mode, and keep rowCount in a memoized value that survives loading.
const [paginationModel, setPaginationModel] = React.useState({ page: 0, pageSize: 25 });
const rowCountRef = React.useRef(rowCount || 0);
const stableRowCount = React.useMemo(() => {
if (rowCount !== undefined) rowCountRef.current = rowCount;
return rowCountRef.current;
}, [rowCount]);
<DataGrid
rows={rows}
columns={columns}
rowCount={stableRowCount}
loading={isLoading}
paginationMode="server"
paginationModel={paginationModel}
onPaginationModelChange={setPaginationModel}
/>3Verify
Click next page. A request for the new page goes out and the grid stays on it.
npm run devConfirmed by mui.com
Cause 4 of 4
autoPageSize combined with autoHeight
1Check
autoHeight sizes the grid from pageSize, which conflicts with autoPageSize.
grep -rn "autoPageSize\|autoHeight" src/2Fix
Remove one of the two props.
<DataGrid rows={rows} columns={columns} autoPageSize />3Verify
The grid fills its container and pages by what fits.
npm run devConfirmed by mui.com
How do I stop it coming back?
- Keep rowCount stable while a page is loading.
- Check the license tier before relying on page sizes over 100.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Web apps
MUI X Data Grid squeezes its columns or does not scroll sideways
All columns are squeezed into the container and no horizontal scrollbar appears
A MUI X Data Grid scrolls sideways only when its columns are wider than the grid itself.
4 causes, each with a fixWeb apps
Module not found for antd/dist/antd.less after upgrading to Ant Design 5
Module not found: Error: Can't resolve 'antd/dist/antd.less'
Ant Design 5 dropped Less and the bundled CSS file for CSS-in-JS, so antd/dist/antd.less no longer exists.
3 causes, each with a fixWeb apps
Astro Code component fails inside a React component
Astro components cannot be rendered directly via function call
Astro components such as Code only exist on the server and render static HTML.
2 causes, each with a fixWeb apps
React shows Attempted import error when importing a component or function
Attempted import error:
The build found the file but not the name you asked for.
2 causes, each with a fixWeb apps
How to catch and handle a 422 from Axios in a Redux thunk
action.error.message is 'Rejected' and action.payload is undefined
A 422 means the server read the request but cannot process its content, so repeating it unchanged fails again.
4 causes, each with a fixWeb apps
axios gets 429 Too Many Requests from a React app
429 (Too Many Requests)
A 429 comes from the server or an API gateway, not from axios: your client sent too many requests in a window.
4 causes, each with a fix