Skip to content

[BUG] #7242

@e-muravev

Description

@e-muravev

Describe the bug

Using conditional mui useDataGrid initial filters with syncWithLocation causes error after reloading page.
With syncWithLocation: false initial filters work well, with syncWithLocation: true not working.

Steps To Reproduce

  1. use mui DataGrid hook with initial filters like
    { operator: 'or', value: [ { operator: 'and', value: [ { field: 'isDismissed', operator: 'eq', value: true }, { field: 'participation.id', operator: 'nnull', value: '' }, ], }, { operator: 'and', value: [{ field: 'isDismissed', operator: 'eq', value: false }], }, ], }, and syncWithLocation: true
  2. reload page
  3. we got toast with error: cannot read properties of undefined (reading map)
  4. in console we got filters from useDataGrid hook like:
    [ { "operator": "or", "value": [ { "operator": "and", "value": [ { "[field]": "isDismissed", "[operator]": "eq", "[value]": "true" }, { "[field]": "participation.id", "[operator]": "nnull", "[value]": "" } ] }, { "operator": "and", "value": [ { "[field]": "isDismissed", "[operator]": "eq", "[value]": "false" } ] } ] } ]
    we got [field] instead field, [operator] instead operator and [value] instead value.

Expected behavior

After reloading the page, we should deserialize the correct filters from the URL.

Packages

"@mui/material": "^6.1.7",
"@mui/x-data-grid": "^7.23.5",
"@mui/x-date-pickers": "^8.12.0",
"@refinedev/cli": "^2.16.48",
"@refinedev/core": "^5.0.0",
"@refinedev/devtools": "^2.0.1",
"@refinedev/kbar": "^2.0.0",
"@refinedev/mui": "^7.0.0",
"@refinedev/nestjsx-crud": "^6.0.0",
"@refinedev/react-hook-form": "^5.0.2",
"@refinedev/react-router": "^2.0.0",

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions