Skip to content

[DataGrid][docs] Fix "Apply filters on demand" demo - #23602

Merged
JCQuintas merged 1 commit into
mui:masterfrom
mateuseap:fix/data-grid-apply-filters-on-demand
Sep 17, 2026
Merged

JCQuintas merged 1 commit into
mui:masterfrom
mateuseap:fix/data-grid-apply-filters-on-demand

Conversation

@mateuseap

Copy link
Copy Markdown
Contributor

Fixes #23495

The "Apply filters on demand" demo initialized its draft filter model by calling gridFilterModelSelector(apiRef) inside the useState initializer. This reads apiRef.current during render, which triggers the React warning reported in the issue.

The demo now reads the active filter model with useGridSelector and uses that value to initialize the local draft. The existing behavior is preserved: opening the panel initializes the draft from the active model, clicking Apply updates the grid, and closing the panel discards unapplied changes.

The generated JavaScript demo was updated with pnpm docs:typescript:formatted.

Changelog

@code-infra-dashboard

Copy link
Copy Markdown

Deploy preview

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(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.

@zannager zannager added the scope: data grid Changes related to the data grid. label Sep 16, 2026
@michelengelen
michelengelen requested review from a team September 17, 2026 08:40
@michelengelen michelengelen added type: bug It doesn't behave as expected. docs Improvements or additions to the documentation. labels Sep 17, 2026
@JCQuintas
JCQuintas merged commit 4f51fde into mui:master Sep 17, 2026
23 of 27 checks passed
@mateuseap
mateuseap deleted the fix/data-grid-apply-filters-on-demand branch September 19, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation. 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] Error in the "Apply filters on demand"

4 participants