Skip to content

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

Open
harsha-cpp wants to merge 1 commit intorefinedev:mainfrom
harsha-cpp:fix/nested-filters-sync-location
Open

fix(core,nextjs-router,remix-router): parse deeply nested conditional filters with syncWithLocation#7245
harsha-cpp wants to merge 1 commit intorefinedev:mainfrom
harsha-cpp:fix/nested-filters-sync-location

Conversation

@harsha-cpp
Copy link

@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

changeset-bot bot commented Feb 3, 2026

🦋 Changeset detected

Latest commit: d4ea0ef

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

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

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]

1 participant