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

[Compiler Bug]: healthcheck do not check next.js StrictMode #30049

Open
1 of 4 tasks
coleea opened this issue Jun 23, 2024 · 5 comments
Open
1 of 4 tasks

[Compiler Bug]: healthcheck do not check next.js StrictMode #30049

coleea opened this issue Jun 23, 2024 · 5 comments
Labels
Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug

Comments

@coleea
Copy link

coleea commented Jun 23, 2024

What kind of issue is this?

  • React Compiler core (the JS output is incorrect, or your app works incorrectly after optimization)
  • babel-plugin-react-compiler (build issue installing or using the Babel plugin)
  • eslint-plugin-react-compiler (build issue installing or using the eslint plugin)
  • react-compiler-healthcheck (build issue installing or using the healthcheck script)

Link to repro

https://github.com/coleea/bug-report-next15-server-action

Repro steps

just run command npx react-compiler-healthcheck@latest.
then, react-compiler-healthcheck does not check StrictMode even though Next.js is actually StrictMode.

Next.js is StrictMode by default under these two conditions are met

  1. Next.js version 13.4+
  2. App router

You can check this : https://rc.nextjs.org/docs/app/api-reference/next-config-js/reactStrictMode

So, It needs extra three steps to check whether StrictMode or Not.

  1. check package.json if Next.js version is over 13.4 or not.
  2. If so, Check if reactStrictMode: false is not set.
  3. check if project is App-Router-based.

If three conditions are met, this project is based on StrictMode even though reactStrictMode: true is not set on next.config.mjs file.

How often does this bug happen?

Every time

What version of React are you using?

19.0.0-rc.0

@coleea coleea added Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug labels Jun 23, 2024
@coleea
Copy link
Author

coleea commented Jun 23, 2024

If my argument is not wrong, I am willing to implement it, so please reply

@gsathya
Copy link
Member

gsathya commented Jun 24, 2024

This is already fixed: #29167

This will roll out once we make a new release of the healthcheck script

@gsathya gsathya closed this as completed Jun 24, 2024
@coleea
Copy link
Author

coleea commented Jun 24, 2024

@gsathya The PR you mentioned is just check whether reactStrictMode: true
option exists in next.config.mjs or not. that's not enough.
I wrote this issue after reading this PR.

@coleea
Copy link
Author

coleea commented Jun 24, 2024

There are 6 cases

  1. App router + reactStrictMode: true => strict mode. PR cover this case.
  2. App router + reactStrictMode: false => non-strict mode. PR cover this case.
  3. App router + reactStrictMode option is not set => strict mode. PR does not cover this case.
  4. Page router + reactStrictMode: true => strict mode. PR cover this case.
  5. Page router + reactStrictMode: false => non-strict mode. PR cover this case.
  6. Page router + reactStrictMode option is not set => non-strict mode. PR cover this case.

Please check the 3rd case to determine whether #29167 covers this or not.

@gsathya
Copy link
Member

gsathya commented Jun 24, 2024

Ah good point, I'll re-open this.

@gsathya gsathya reopened this Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug
Projects
None yet
Development

No branches or pull requests

2 participants