-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Move modern strict to experimental #28152
Conversation
Comparing: 374fd68...4afefce Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
Noob question, I don't see a stray |
848cc06
to
ed38c95
Compare
oh wow @tyao1 you're right, i haven't used classes in so long i forgot what the method was called, i was expecting |
ed38c95
to
2460666
Compare
Yeah I have no idea what that failure is, dev tools seems to error but I cannot figure out how to see what the error is. @hoxyq are you familiar with this test at all or know how to debug it to see what the error is? I tried and got stuck in test abstraction hell |
Looking into that now |
I was able to triage up to this line:
Let me share a bit more context whats going on here:
With modern strict and legacy render, the Questions:
Possible reason why this happens:
|
Next steps for me: I need to validate if migrating DevTools tests to using The tricky part here is that DevTools tests are gated for a specific React version:
Currently, this is only partially implemented and we don't use react/packages/react-devtools-shared/src/__tests__/utils.js Lines 22 to 24 in 2477384
react/packages/react-devtools-shared/src/__tests__/utils.js Lines 49 to 51 in 2477384
Can this change wait before the end of the week, so I can try to implement this? |
Do you have a sense for why that would work? I can't figure out what the unexpected error actually is, I can only find the error count. If I knew the error, I could tell you if that would fix it. Based on the changes, I wouldn't expect any new errors (this is only a strict mode change, and these tests don't use strict mode) so I don't expect changing act would fix it. |
There is more to that, this flag is used in reconciler: react/packages/react-reconciler/src/ReactFiberWorkLoop.js Lines 3706 to 3728 in 45582c6
Its actually changes the way how current fiber is set in DEV:
And this is the injected dependency from React into React DevTools (getCurrentFiber), so RDT will know which fiber has just emitted an error. For some reason, if we are using Maybe there is someone who can explain the reason behind having internal version of |
Okay, I think I found the issue here. React DevTools console patching works incorrectly for this scenario with modern strict mode. When React DevTools hook is injected, it sets up the callback In this case with modern strict mode, such patching doesn't happen, that is why the error is not properly filtered. |
Nope, this is not the case here, unfortunately: validated that with legacy strict mode these functions are also not called. |
2460666
to
f552806
Compare
let doubleInvokeEffects = true; | ||
|
||
if (root.tag === LegacyRoot && !(root.current.mode & StrictLegacyMode)) { | ||
doubleInvokeEffects = false; | ||
} |
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.
@sammy-SC @acdlite, I fixed this bug that turned on strict effects in Legacy Mode, which may be the reason it was hard to land internally, breaking unit tests and whatnot.
Previously, legacyCommitDoubleInvokeEffectsInDEV
would be called in the legacy root too (when strict mode was on), but we wouldn't fire any effects because no fiber flags were set. When we copied over the check to this block, it forces effects to be fired, since it's not checking fiber flags (by design).
We have a test that caught this, but we didn't have any test variants that enabled useModernStrictMode
:
it('should not double invoke effects in legacy mode', async () => { |
### React upstream changes - facebook/react#28333 - facebook/react#28334 - facebook/react#28378 - facebook/react#28377 - facebook/react#28376 - facebook/react#28338 - facebook/react#28331 - facebook/react#28336 - facebook/react#28320 - facebook/react#28317 - facebook/react#28375 - facebook/react#28367 - facebook/react#28380 - facebook/react#28368 - facebook/react#28343 - facebook/react#28355 - facebook/react#28374 - facebook/react#28362 - facebook/react#28344 - facebook/react#28339 - facebook/react#28353 - facebook/react#28346 - facebook/react#25790 - facebook/react#28352 - facebook/react#28326 - facebook/react#27688 - facebook/react#28329 - facebook/react#28332 - facebook/react#28340 - facebook/react#28327 - facebook/react#28325 - facebook/react#28324 - facebook/react#28309 - facebook/react#28310 - facebook/react#28307 - facebook/react#28306 - facebook/react#28315 - facebook/react#28318 - facebook/react#28226 - facebook/react#28308 - facebook/react#27563 - facebook/react#28297 - facebook/react#28286 - facebook/react#28284 - facebook/react#28275 - facebook/react#28145 - facebook/react#28301 - facebook/react#28224 - facebook/react#28152 - facebook/react#28296 - facebook/react#28294 - facebook/react#28279 - facebook/react#28273 - facebook/react#28269 - facebook/react#28376 - facebook/react#28338 - facebook/react#28331 - facebook/react#28336 - facebook/react#28320 - facebook/react#28317 - facebook/react#28375 - facebook/react#28367 - facebook/react#28380 - facebook/react#28368 - facebook/react#28343 - facebook/react#28355 - facebook/react#28374 - facebook/react#28362 - facebook/react#28344 - facebook/react#28339 - facebook/react#28353 - facebook/react#28346 - facebook/react#25790 - facebook/react#28352 - facebook/react#28326 - facebook/react#27688 - facebook/react#28329 - facebook/react#28332 - facebook/react#28340 - facebook/react#28327 - facebook/react#28325 - facebook/react#28324 - facebook/react#28309 - facebook/react#28310 - facebook/react#28307 - facebook/react#28306 - facebook/react#28315 - facebook/react#28318 - facebook/react#28226 - facebook/react#28308 - facebook/react#27563 - facebook/react#28297 - facebook/react#28286 - facebook/react#28284 - facebook/react#28275 - facebook/react#28145 - facebook/react#28301 - facebook/react#28224 - facebook/react#28152 - facebook/react#28296 - facebook/react#28294 - facebook/react#28279 - facebook/react#28273 - facebook/react#28269 Closes NEXT-2542 Disable ppr test for strict mode for now, @acdlite will check it and we'll sync again
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. facebook@5d1ce65#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>
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. 5d1ce65#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> DiffTrain build for commit 06e410e.
Turn this on
Edited: ope, nvm
5d1ce65#diff-19df471970763c4790c2cc0811fd2726cc6a891b0e1d5dedbf6d0599240c127aR70
Before:
After:
So there's a bug somewhere