Skip to content

[DataGridPro] Skip the infinite loader when IntersectionObserver is unavailable - #23869

Merged
michelengelen merged 2 commits into
mui:masterfrom
michelengelen:bugfix/12983-intersection-observer-feature-detect
Oct 14, 2026
Merged

michelengelen merged 2 commits into
mui:masterfrom
michelengelen:bugfix/12983-intersection-observer-feature-detect

Conversation

@michelengelen

Copy link
Copy Markdown
Member

The infinite loading hook creates an IntersectionObserver with no check that the API exists. jsdom does not implement IntersectionObserver, so any Jest or Vitest test that renders DataGridPro or DataGridPremium with onRowsScrollEnd or lazyLoading crashes with IntersectionObserver is not defined. The hook now checks that IntersectionObserver is defined before it creates the observer, in the same way as the Material UI Tabs component. When the API is not available, the grid renders as usual, and scroll-end loading does not start. Behavior in browsers does not change.

A new test removes IntersectionObserver with vi.stubGlobal and renders the grid. Unlike the other infinite loader tests, this test also runs in jsdom.

Fixes #12983

@michelengelen michelengelen self-assigned this Oct 14, 2026
@michelengelen michelengelen added type: bug It doesn't behave as expected. scope: data grid Changes related to the data grid. labels Oct 14, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-23869--material-ui-x.netlify.app/
QR code for https://deploy-preview-23869--material-ui-x.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 🔺+33B(+0.01%) 🔺+7B(0.00%)
@mui/x-data-grid-premium 🔺+33B(0.00%) 🔺+9B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-scheduler 0B(0.00%) 0B(0.00%)
@mui/x-scheduler-premium 0B(0.00%) 0B(0.00%)
@mui/x-chat 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

…er/useGridInfiniteLoadingIntersection.tsx

Co-authored-by: Armin Mehinovic <4390250+arminmeh@users.noreply.github.com>
Signed-off-by: Michel Engelen <32863416+michelengelen@users.noreply.github.com>
@michelengelen
michelengelen enabled auto-merge (squash) October 14, 2026 12:23
@michelengelen
michelengelen merged commit bb5f645 into mui:master Oct 14, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: data grid Changes related to the data grid. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[data grid] Tests fail with: "IntersectionObserver is not defined" after upgrading to x-data-grid v7.3.2

2 participants