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

Re-render details if rewrites are used #34049

Merged
merged 5 commits into from Feb 10, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/advanced-features/automatic-static-optimization.md
Expand Up @@ -20,6 +20,8 @@ If the above is not the case, Next.js will **statically optimize** your page aut

During prerendering, the router's `query` object will be empty since we do not have `query` information to provide during this phase. After hydration, Next.js will trigger an update to your application to provide the route parameters in the `query` object.

However, with `Rewrites` in your code, a re-render is triggered to provide the parsed parameters. This is because [rewrites](/docs/api-reference/next.config.js/rewrites) can have parameters that we need to provide in the `query` object.
MaedahBatool marked this conversation as resolved.
Show resolved Hide resolved
MaedahBatool marked this conversation as resolved.
Show resolved Hide resolved

> **Note:** Parameters added with [dynamic routes](/docs/routing/dynamic-routes.md) to a page that's using [`getStaticProps`](/docs/basic-features/data-fetching/get-static-props.md) will always be available inside the `query` object.

`next build` will emit `.html` files for statically optimized pages. For example, the result for the page `pages/about.js` would be:
Expand Down