Skip to content

feat(mui): add filters.syncFilterModel option to useDataGrid#7420

Closed
jwgmeligmeyling wants to merge 1 commit into
refinedev:mainfrom
athenagroup:claude/dreamy-dubinsky-6008dd
Closed

feat(mui): add filters.syncFilterModel option to useDataGrid#7420
jwgmeligmeyling wants to merge 1 commit into
refinedev:mainfrom
athenagroup:claude/dreamy-dubinsky-6008dd

Conversation

@jwgmeligmeyling
Copy link
Copy Markdown
Contributor

useDataGrid controls dataGridProps.filterModel from an internal muiCrudFilters state that is only updated by the DataGrid's own filter panel and by search(). Calls to the returned setFilters (or filter changes synced from the URL via syncWithLocation) updated filters but left filterModel stale, so apps driving filters from external UIs could not reflect their state in the grid.

Add an opt-in filters.syncFilterModel flag. When true, a useEffect mirrors filters into muiCrudFilters via isEqual guard, so external mutations land in filterModel without a no-op re-render on the debounced internal path. The default is false to preserve the behavior agreed on in the original bug report, where unconditional syncing was rejected because it can clobber in-progress column-header edits in apps that mix DataGrid filter inputs and external setFilters calls.

Refs: #5860

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

What is the new behavior?

fixes (issue)

Notes for reviewers

useDataGrid controls dataGridProps.filterModel from an internal
muiCrudFilters state that is only updated by the DataGrid's own filter
panel and by search(). Calls to the returned setFilters (or filter
changes synced from the URL via syncWithLocation) updated filters but
left filterModel stale, so apps driving filters from external UIs
could not reflect their state in the grid.

Add an opt-in filters.syncFilterModel flag. When true, a useEffect
mirrors filters into muiCrudFilters via isEqual guard, so external
mutations land in filterModel without a no-op re-render on the
debounced internal path. The default is false to preserve the
behavior agreed on in the original bug report, where unconditional
syncing was rejected because it can clobber in-progress column-header
edits in apps that mix DataGrid filter inputs and external setFilters
calls.

Refs: refinedev#5860
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 15, 2026

🦋 Changeset detected

Latest commit: 109e840

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@refinedev/mui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant