@samitouri / QOS-React / commits / 06e410ec60

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. https://github.com/facebook/react/commit/5d1ce651393524639a3b4b1e861a0413a4d25629#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>

Ricky committed Feb 9, 2024 at 16:59 UTC 06e410ec608820b65d81536bb4630228b4e04d48
2 files changed +2 -5
packages/react-reconciler/src/ReactFiberWorkLoop.js
+1 -4
@@ -3792,12 +3792,9 @@ function commitDoubleInvokeEffectsInDEV(
3792 hasPassiveEffects: boolean,
3793 ) {
3794 if (__DEV__) {
3795 - if (useModernStrictMode) {
3795 + if (useModernStrictMode && root.tag !== LegacyRoot) {
3796 let doubleInvokeEffects = true;
3797
3798 - if (root.tag === LegacyRoot && !(root.current.mode & StrictLegacyMode)) {
3799 - doubleInvokeEffects = false;
3800 - }
3798 if (
3799 root.tag === ConcurrentRoot &&
3800 !(root.current.mode & (StrictLegacyMode | StrictEffectsMode))
packages/shared/ReactFeatureFlags.js
+1 -1
@@ -147,7 +147,7 @@ export const disableJavaScriptURLs = false;
147 // Modern <StrictMode /> behaviour aligns more with what components
148 // components will encounter in production, especially when used With <Offscreen />.
149 // TODO: clean up legacy <StrictMode /> once tests pass WWW.
150 -export const useModernStrictMode = false;
150 +export const useModernStrictMode = __NEXT_MAJOR__;
151
152 // Not ready to break experimental yet.
153 // Remove IE and MsApp specific workarounds for innerHTML