Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic routing behaves differently in Dev vs Prod #7880

Closed
Timer opened this issue Jul 10, 2019 · 4 comments · Fixed by #7883
Closed

Dynamic routing behaves differently in Dev vs Prod #7880

Timer opened this issue Jul 10, 2019 · 4 comments · Fixed by #7883
Assignees
Milestone

Comments

@Timer
Copy link
Member

Timer commented Jul 10, 2019

In dev, prerendered pages have their queries empty. In prod, the queries are the placeholders [param].

The desired behavior is for both of these to be empty. Not sure if we should use undefined, null, or ''.

I'm leaning towards null or empty string.

This must have a failing test added in a PR before it can be fixed.

@brunolemos
Copy link

I'm using v9, useRouter returns an empty query object in the first render (from server):

image

Why is that the desired behavior? I expected the autostart to be inside query.

@Timer
Copy link
Member Author

Timer commented Aug 2, 2019

@brunolemos your page is likely being statically optimized, meaning it was prerendered without any query parameters -- in production, this means your page isn't being rendered on-request (SSR).

The page will hydrate on the client and trigger the router update, at which point you can handle the autostart feature.

@brunolemos
Copy link

Got it! My bad, I was using useEffect(..., []) because I thought it was gonna be included in the first render, but it does arrive on a later render.

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants