Skip to content

fix(core,nextjs-router,remix-router): parse deeply nested conditional filters with syncWithLocation#7245

Merged
alicanerdurmaz merged 4 commits into
refinedev:mainfrom
harsha-cpp:fix/nested-filters-sync-location
Mar 4, 2026
Merged

fix(core,nextjs-router,remix-router): parse deeply nested conditional filters with syncWithLocation#7245
alicanerdurmaz merged 4 commits into
refinedev:mainfrom
harsha-cpp:fix/nested-filters-sync-location

Conversation

@harsha-cpp
Copy link
Copy Markdown
Contributor

@harsha-cpp harsha-cpp commented Feb 3, 2026

PR Checklist

What is the current behavior?

When using useDataGrid (or useTable) with syncWithLocation: true and deeply nested conditional 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 }],
    },
  ],
}

After page reload, the filters are incorrectly deserialized from the URL. The nested filter properties become bracket notation keys:

{ "[field]": "isDismissed", "[operator]": "eq", "[value]": "true" }

Instead of:

{ field: "isDismissed", operator: "eq", value: "true" }

This causes errors like cannot read properties of undefined (reading 'map').

What is the new behavior?

Deeply nested conditional filters are now correctly parsed from the URL after page reload. The qs.parse depth has been increased from the default 5 to 10, which supports the nesting depth required by conditional filters (orand{field, operator, value} = 7+ levels).

Notes for reviewers

The fix is applied to all three packages that use qs.parse for table params:

  • @refinedev/core
  • @refinedev/nextjs-router
  • @refinedev/remix-router

A regression test has been added to verify deeply nested conditional filters are correctly round-tripped through stringify/parse.

Fixes #7242

… filters from URL

Increased qs.parse depth from default 5 to 10 to correctly deserialize
deeply nested conditional filters (or -> and -> filter) when using
syncWithLocation. Previously, filter properties were incorrectly parsed
as bracket notation keys ([field], [operator], [value]) after page reload.
@harsha-cpp harsha-cpp requested a review from a team as a code owner February 3, 2026 09:21
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 3, 2026

🦋 Changeset detected

Latest commit: 7d99f1e

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

This PR includes changesets to release 4 packages
Name Type
@refinedev/core Patch
@refinedev/nextjs-router Patch
@refinedev/remix-router Patch
@refinedev/react-router 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

@alicanerdurmaz alicanerdurmaz merged commit bf3cc65 into refinedev:main Mar 4, 2026
11 checks passed
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.

[BUG]

2 participants