Skip to content
Discussion options

You must be logged in to vote

You can use router.isReady to determine when the router.query value is available.

https://nextjs.org/docs/api-reference/next/router#router-object

This behavior is expected, per these docs: https://nextjs.org/docs/routing/dynamic-routes#caveats

Pages that are statically optimized by Automatic Static Optimization will be hydrated without their route parameters provided, i.e query will be an empty object ({}).

After hydration, Next.js will trigger an update to your application to provide the route parameters in the query object.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@BernieSumption
Comment options

@jamesmosier
Comment options

@BernieSumption
Comment options

@ivan-kleshnin
Comment options

Answer selected by jamesmosier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #21520 on January 26, 2021 02:06.