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

The app renders twice when using rewrites in next.config.js #27224

Closed
meotimdihia opened this issue Jul 16, 2021 · 2 comments
Closed

The app renders twice when using rewrites in next.config.js #27224

meotimdihia opened this issue Jul 16, 2021 · 2 comments
Labels
bug Issue was opened via the bug report template.

Comments

@meotimdihia
Copy link

What version of Next.js are you using?

11.0.1

What version of Node.js are you using?

14

What browser are you using?

chrome

What operating system are you using?

Windows, Linux

How are you deploying your application?

yarn dev, yarn build && yarn start

Describe the Bug

The app renders twice when using rewrites in next.config.js. This is the demo:
https://stackblitz.com/edit/github-xxgqsj?file=next.config.js

Expected Behavior

It should render once only

To Reproduce

const moduleExports = {
  async rewrites() {
    return [
      {
        source: '/index2',
        destination: '/index3'
      }
    ];
  }
};

module.exports = moduleExports;
@meotimdihia meotimdihia added the bug Issue was opened via the bug report template. label Jul 16, 2021
@ijjk
Copy link
Member

ijjk commented Jul 16, 2021

Hi, this is currently expected since the page being rewritten to is an automatically statically optimized page which means we need to ensure we parse the rewrites on the client and collect any params after hydration so that they can be provided in router.query.

I'm going to close this since it doesn't appear to be a bug

@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 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

3 participants