Skip to content

[bug] TanStack Router adapter: search params with array of objects serialized as [object Object] #1127

@gensmusic

Description

@gensmusic

Context

What's your version of nuqs?

"nuqs": "2.6.0"

What framework are you using?

  • ✅Other (TanStack Router)

Which version of your framework are you using?

"@tanstack/react-router": "1.x"
"react": "18.x"

Description

When using Nuqs with the TanStack Router adapter,
search params containing objects or arrays of objects are incorrectly serialized into strings like: [object Object]

This causes parsing errors when using parseAsJson or custom parsers (e.g. shadcn-table sorting state).

Expected behavior:
The adapter should follow TanStack Router’s default serialization (JSON.stringify / JSON.parse) so that objects/arrays are stored as valid JSON strings in the URL.

We previously discussed this issue here:
#953 (comment)

Reference docs:
https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization

Reproduction

Metadata

Metadata

Assignees

No one assigned

    Labels

    adapters/tanstack-routerUses the TanStack Router adapterbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions