-
Notifications
You must be signed in to change notification settings - Fork 46.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make temporary NoStrictPassiveEffects
option work with useModernStrictMode
#27105
Conversation
doubleInvokeEffectsOnFiber( | ||
root, | ||
fiber, | ||
(fiber.mode & NoStrictPassiveEffectsMode) === NoMode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the mode be passed down below on L3597 as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I checked the test case where a Suspense boundary is used
react/packages/react/src/__tests__/ReactStrictMode-test.internal.js
Lines 130 to 150 in 546fe46
it('should include legacy + strict effects mode, but not strict passive effect with disableStrictPassiveEffect in Suspense', async () => { | |
await act(() => { | |
const container = document.createElement('div'); | |
const root = ReactDOMClient.createRoot(container); | |
root.render( | |
<React.StrictMode DO_NOT_USE_disableStrictPassiveEffect={true}> | |
<React.Suspense> | |
<Component label="A" /> | |
</React.Suspense> | |
</React.StrictMode>, | |
); | |
}); | |
expect(log).toEqual([ | |
'A: render', | |
'A: render', | |
'A: useLayoutEffect mount', | |
'A: useEffect mount', | |
'A: useLayoutEffect unmount', | |
'A: useLayoutEffect mount', | |
]); |
and the codepath on L3597 doesn't hit. So no, we don't need this flag for components under a real Offscreen component.
Updated React from 9377e1010 to cb3404a0c. ### React upstream changes - facebook/react#27190 - facebook/react#27189 - facebook/react#27201 - facebook/react#27147 - facebook/react#26949 - facebook/react#27058 - facebook/react#27142 - facebook/react#27133 - facebook/react#27130 - facebook/react#27105 - facebook/react#27117 - facebook/react#27057
…rictMode` (facebook#27105) ## Summary Since we are enabling `useModernStrictMode` flag internally, to make sure the internal testing of half StrictMode doesn't suddenly break, this PR makes sure it also works with `useModernStrictMode` true. ## Test plan: Manually set `useModernStrictMode` to true. `yarn test ReactOffscreenStrictMode-test -r=www-modern --env=development --variant=true` `yarn test ReactStrictMode-test.internal -r=www-modern --env=development --variant=true`
…rictMode` (#27105) ## Summary Since we are enabling `useModernStrictMode` flag internally, to make sure the internal testing of half StrictMode doesn't suddenly break, this PR makes sure it also works with `useModernStrictMode` true. ## Test plan: Manually set `useModernStrictMode` to true. `yarn test ReactOffscreenStrictMode-test -r=www-modern --env=development --variant=true` `yarn test ReactStrictMode-test.internal -r=www-modern --env=development --variant=true` DiffTrain build for commit d445cee.
Summary
Since we are enabling
useModernStrictMode
flag internally, to make sure the internal testing of half StrictMode doesn't suddenly break, this PR makes sure it also works withuseModernStrictMode
true.Test plan:
Manually set
useModernStrictMode
to true.yarn test ReactOffscreenStrictMode-test -r=www-modern --env=development --variant=true
yarn test ReactStrictMode-test.internal -r=www-modern --env=development --variant=true