Skip to content

Commit 06e410e

Browse files
authored
Move modern strict to experimental (#28152)
Turn this on Edited: ope, nvm <details> Looks like there's still an outstanding issue with this. The original PR turned off a strict effects test, which causes a stray `componentWillUnmount` to fire. 5d1ce65#diff-19df471970763c4790c2cc0811fd2726cc6a891b0e1d5dedbf6d0599240c127aR70 Before: ```js expect(log).toEqual([ 'constructor', 'constructor', 'getDerivedStateFromProps', 'getDerivedStateFromProps', 'render', 'render', 'componentDidMount', ]); ``` After: ```js expect(log).toEqual([ 'constructor', 'constructor', 'getDerivedStateFromProps', 'getDerivedStateFromProps', 'render', 'render', 'componentDidMount', 'componentWillUnmount', 'componentDidMount', ]); ``` So there's a bug somewhere </details>
1 parent 374fd68 commit 06e410e

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

packages/react-reconciler/src/ReactFiberWorkLoop.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3792,12 +3792,9 @@ function commitDoubleInvokeEffectsInDEV(
37923792
hasPassiveEffects: boolean,
37933793
) {
37943794
if (__DEV__) {
3795-
if (useModernStrictMode) {
3795+
if (useModernStrictMode && root.tag !== LegacyRoot) {
37963796
let doubleInvokeEffects = true;
37973797

3798-
if (root.tag === LegacyRoot && !(root.current.mode & StrictLegacyMode)) {
3799-
doubleInvokeEffects = false;
3800-
}
38013798
if (
38023799
root.tag === ConcurrentRoot &&
38033800
!(root.current.mode & (StrictLegacyMode | StrictEffectsMode))

packages/shared/ReactFeatureFlags.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const disableJavaScriptURLs = false;
147147
// Modern <StrictMode /> behaviour aligns more with what components
148148
// components will encounter in production, especially when used With <Offscreen />.
149149
// TODO: clean up legacy <StrictMode /> once tests pass WWW.
150-
export const useModernStrictMode = false;
150+
export const useModernStrictMode = __NEXT_MAJOR__;
151151

152152
// Not ready to break experimental yet.
153153
// Remove IE and MsApp specific workarounds for innerHTML

0 commit comments

Comments
 (0)