Skip to content

Commit

Permalink
Move modern strict to experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed Jan 29, 2024
1 parent 4d6c47b commit 2460666
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
32 changes: 23 additions & 9 deletions packages/react/src/__tests__/ReactStrictMode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,29 @@ describe('ReactStrictMode', () => {
container,
);

expect(log).toEqual([
'constructor',
'constructor',
'getDerivedStateFromProps',
'getDerivedStateFromProps',
'render',
'render',
'componentDidMount',
]);
if (gate(flags => flags.useModernStrictMode)) {
expect(log).toEqual([
'constructor',
'constructor',
'getDerivedStateFromProps',
'getDerivedStateFromProps',
'render',
'render',
'componentDidMount',
'componentWillUnmount',
'componentDidMount',
]);
} else {
expect(log).toEqual([
'constructor',
'constructor',
'getDerivedStateFromProps',
'getDerivedStateFromProps',
'render',
'render',
'componentDidMount',
]);
}

log = [];
shouldComponentUpdate = true;
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2460666

Please sign in to comment.