generated from chiffre-io/template-library
-
-
Notifications
You must be signed in to change notification settings - Fork 256
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Context
What's your version of nuqs?
"nuqs": "^2.3.2",
What framework are you using?
- ✅ Next.js (app router)
Which version of your framework are you using?
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6041
Available memory (MB): 49152
Available CPU cores: 14
Binaries:
Node: 25.2.1
npm: 11.6.2
Yarn: 4.8.1
pnpm: 10.23.0
Relevant Packages:
next: 15.2.4
eslint-config-next: 15.2.4
react: 19.1.0
react-dom: 19.1.0
typescript: 5.8.2
Next.js Config:
output: N/A
Description
I have the following.
import {
createSerializer,
parseAsArrayOf,
parseAsInteger,
} from 'nuqs/server';
const keyMaps = {
otherValue: parseAsInteger),
excludeIds: parseAsArrayOf(parseAsInteger).withDefault([]),
};
const estimationSerializer = createSerializer(keyMaps);
In nextjs Im trying creating a link to another page, but I don't want to pass excludeIds.
According to the interface I could then pass excludeIds?: number[] | null | undefined and what I thought passing null would do is reset to default .eg. [].
const newSearchParams = estimationSerializer({
...params,
excludeIds: null,
});
Passing null works in dev mode, and value gets reset. But if I run the code in production, I get the following.
TypeError: Cannot read properties of null (reading 'length')
Only way to get it working is to actually pass an empty array.
const newSearchParams = estimationSerializer({
...params,
excludeIds: [],
});
How come it works in dev, but not production and if your not actually suposed to pass null, how come the interface says so.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working