-
Notifications
You must be signed in to change notification settings - Fork 329
Open
Description
React Scan would not run in many conditions where multiple react root exists, such as Next.js dev environment.
react-scan/packages/scan/src/core/index.ts
Line 537 in 0fae9f3
| export const getIsProduction = () => { |
export const getIsProduction = () => {
if (isProduction !== null) {
return isProduction;
}
rdtHook ??= getRDTHook();
for (const renderer of rdtHook.renderers.values()) {
const buildType = detectReactBuildType(renderer);
if (buildType === 'production') {
isProduction = true;
}
}
return isProduction;
};
For example, in Next.js dev environment, the next-devtools overlay uses production build of react and has separate root.
getIsProduction helper wrongly sets isProduction to true, so react-scan is not enabled.
For temporary workaround, you can set dangerouslyForceRunInProduction option to true and use other methods to decide whether to run scan.
Metadata
Metadata
Assignees
Labels
No labels