-
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
Double-render function components with Hooks in DEV in StrictMode #14643
Conversation
TestRenderer is built with strict mode doublerender off. We could change that but I'm not sure we want to. So I'll just flip the flag off for this test.
Details of bundled changes.Comparing: 10a7a5b...ee5cb17 react-dom
react-art
react-native-renderer
react-test-renderer
react-reconciler
Generated by 🚫 dangerJS |
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.
Personally, I much prefer this approach. Less risky and also not a breaking change (even if the logic from before was DEV only).
I'll merge to unblock the sync. |
…Mode" (#14652) * Revert "Revert "Disallow reading context during useMemo etc" (#14651)" This reverts commit 5fce648. * Revert "Add test coverage for readContext() on the server (#14649)" This reverts commit fe2ecd2. * Revert "Warn about incorrect use of useImperativeHandle() (#14647)" This reverts commit 8f45a7f. * Revert "Disallow reading context during useMemo etc (#14648)" This reverts commit 1fcbd22. * Revert "Warn about refs on lazy function components (#14645)" This reverts commit 2a084f5. * Revert "Fix typo (#14560)" This reverts commit b5a3df6. * Revert "fix typo (#14316)" This reverts commit 9c146e6. * Revert "Mention forwardRef() in <Fn ref={...} /> errors and warnings (#14644)" This reverts commit baa6d40. * Revert "Double-render function components with Hooks in DEV in StrictMode (#14643)" This reverts commit a1414e8.
Nice compromise, Dan |
I already reverted |
(Resubmitted in #14654) |
Hm? This was just a follow up comment from #14639. I just meant the concept of doing the double-rendering only for function components that used hooks. Seems like a nice compromise from double rendering everything. |
Just wanted to clarify we haven't actually landed this |
…cebook#14643) * Double-render functions in strict mode * Double-invoke first function component render too * Mark TestRendererAsync test as internal and revert changes to it TestRenderer is built with strict mode doublerender off. We could change that but I'm not sure we want to. So I'll just flip the flag off for this test. * Only double-invoke components using Hooks * Revert unintentional change
…Mode" (facebook#14652) * Revert "Revert "Disallow reading context during useMemo etc" (facebook#14651)" This reverts commit 5fce648. * Revert "Add test coverage for readContext() on the server (facebook#14649)" This reverts commit fe2ecd2. * Revert "Warn about incorrect use of useImperativeHandle() (facebook#14647)" This reverts commit 8f45a7f. * Revert "Disallow reading context during useMemo etc (facebook#14648)" This reverts commit 1fcbd22. * Revert "Warn about refs on lazy function components (facebook#14645)" This reverts commit 2a084f5. * Revert "Fix typo (facebook#14560)" This reverts commit b5a3df6. * Revert "fix typo (facebook#14316)" This reverts commit 9c146e6. * Revert "Mention forwardRef() in <Fn ref={...} /> errors and warnings (facebook#14644)" This reverts commit baa6d40. * Revert "Double-render function components with Hooks in DEV in StrictMode (facebook#14643)" This reverts commit a1414e8.
…cebook#14643) * Double-render functions in strict mode * Double-invoke first function component render too * Mark TestRendererAsync test as internal and revert changes to it TestRenderer is built with strict mode doublerender off. We could change that but I'm not sure we want to. So I'll just flip the flag off for this test. * Only double-invoke components using Hooks * Revert unintentional change
…Mode" (facebook#14652) * Revert "Revert "Disallow reading context during useMemo etc" (facebook#14651)" This reverts commit 5fce648. * Revert "Add test coverage for readContext() on the server (facebook#14649)" This reverts commit fe2ecd2. * Revert "Warn about incorrect use of useImperativeHandle() (facebook#14647)" This reverts commit 8f45a7f. * Revert "Disallow reading context during useMemo etc (facebook#14648)" This reverts commit 1fcbd22. * Revert "Warn about refs on lazy function components (facebook#14645)" This reverts commit 2a084f5. * Revert "Fix typo (facebook#14560)" This reverts commit b5a3df6. * Revert "fix typo (facebook#14316)" This reverts commit 9c146e6. * Revert "Mention forwardRef() in <Fn ref={...} /> errors and warnings (facebook#14644)" This reverts commit baa6d40. * Revert "Double-render function components with Hooks in DEV in StrictMode (facebook#14643)" This reverts commit a1414e8.
Alternative to #14639. (See last commit.)
Less risky. Would make DEV faster for the stateless case. It's mostly Hooks abuse that we're worried about anyway. Added a test for
useMemo(fn, [])
specifically.