Closed FezVrasta closed 3 days ago
In Next.js 15, the searchParams
page prop is a Promise (docs), you'll need to await
it (at either side of the .parse function, both work):
const Page = async ({ searchParams }: Props) => {
const { q: query, sport: sports } = await createSearchParamsCache({
q: parseAsString,
sport: parseAsArrayOf<keyof typeof SPORTS>(
parseAsStringEnum(Object.keys(SPORTS) as (keyof typeof SPORTS)[]),
).withDefault([]),
}).parse(searchParams);
Ah good to know, thanks!
Context
What's your version of
nuqs
?2.2.1
What framework are you using?
Which version of your framework are you using?
next@npm:15.0.3
Description
I'm trying to upgrade my app from Next 14 to 15, but the following code starts failing:
The
sports
variable ends up beingundefined
when nosport
query parameters are set. On Next 14 it returns an empty array as expected.Reproduction
N/A