mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Debug render-phase side effects in "strict" mode (#12094)
A new feature flag has been added, debugRenderPhaseSideEffectsForStrictMode. When enabled, StrictMode subtrees will also double-invoke lifecycles in the same way as debugRenderPhaseSideEffects. By default, this flag is enabled for __DEV__ only. Internally we can toggle it with a GK. This breaks several of our incremental tests which make use of the noop-renderer. Updating the tests to account for the double-rendering in development mode makes them significantly more complicated. The most straight forward fix for this will be to convert them to be run as internal tests only. I believe this is reasonable since we are the only people making use of the noop renderer.
This commit is contained in:
@@ -26,6 +26,12 @@ export const enableNewContextAPI = false;
|
||||
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
||||
export const debugRenderPhaseSideEffects = false;
|
||||
|
||||
// In some cases, StrictMode should also double-render lifecycles.
|
||||
// This can be confusing for tests though,
|
||||
// And it can be bad for performance in production.
|
||||
// This feature flag can be used to control the behavior:
|
||||
export const debugRenderPhaseSideEffectsForStrictMode = __DEV__;
|
||||
|
||||
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
||||
export const warnAboutDeprecatedLifecycles = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user