47ng / 47ng/nuqs

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

Open
#1,127 5 comments 0 reactions 0 assignees View on GitHub
adapters/tanstack-router bug
Dominant language
TypeScript
Stars
10.8k
Forks
294
Avg merge
1d 16h
Merged PRs (30d)
21

Description

## 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:
https://github.com/47ng/nuqs/pull/953#issuecomment-3272900821

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

## Reproduction

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.