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>
This commit is contained in:
Ricky
2024-02-09 16:59:47 -05:00
committed by GitHub
parent 374fd68a50
commit 06e410ec60
2 changed files with 2 additions and 5 deletions
+1 -4
View File
@@ -3792,12 +3792,9 @@ function commitDoubleInvokeEffectsInDEV(
hasPassiveEffects: boolean,
) {
if (__DEV__) {
if (useModernStrictMode) {
if (useModernStrictMode && root.tag !== LegacyRoot) {
let doubleInvokeEffects = true;
if (root.tag === LegacyRoot && !(root.current.mode & StrictLegacyMode)) {
doubleInvokeEffects = false;
}
if (
root.tag === ConcurrentRoot &&
!(root.current.mode & (StrictLegacyMode | StrictEffectsMode))
+1 -1
View File
@@ -147,7 +147,7 @@ export const disableJavaScriptURLs = false;
// Modern <StrictMode /> behaviour aligns more with what components
// components will encounter in production, especially when used With <Offscreen />.
// TODO: clean up legacy <StrictMode /> once tests pass WWW.
export const useModernStrictMode = false;
export const useModernStrictMode = __NEXT_MAJOR__;
// Not ready to break experimental yet.
// Remove IE and MsApp specific workarounds for innerHTML