Skip to content

Commit

Permalink
Legacy mode never double invokes effects
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed Feb 9, 2024
1 parent a92a3ac commit 4afefce
Showing 1 changed file with 9 additions and 23 deletions.
32 changes: 9 additions & 23 deletions packages/react/src/__tests__/ReactStrictMode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,15 @@ describe('ReactStrictMode', () => {
container,
);

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',
]);
}
expect(log).toEqual([
'constructor',
'constructor',
'getDerivedStateFromProps',
'getDerivedStateFromProps',
'render',
'render',
'componentDidMount',
]);

log = [];
shouldComponentUpdate = true;
Expand Down

0 comments on commit 4afefce

Please sign in to comment.