GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Add concept of StrictMode levels 1 & 2 (no public API yet) by bvaughn · Pull Request #20844 · react/react Conversation
|
|
Comparing: 4190a34...372bb8b 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
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
StrictMode level sounds nice. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Both of the new warnings you refer to are related to render phase side effects, so if anything they both belong in level 1. An argument could be made for warning about mutated refs even outside of strict mode. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry if this is too off-topic - does this mean double invoking the functions passed to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
@jacobp100 For what "strict effects mode" is, check out the original PR: TL;DR: It doesn't just double invoke the functions passed to
--#19523 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
e52ca35 to
dd40e13
Compare
|
Circle CI doing something weird here I think. Hm. Should sort itself out next time I rebase onto master. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I still wonder if we can wait on this until we have more information but happy to move forward if others want to approve and land.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
dd40e13 to
11b8797
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks great, these changes are really exciting 🎉
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| import {emptyRefsObject} from './ReactFiberClassComponent.new'; | ||
| import {isCompatibleFamilyForHotReloading} from './ReactFiberHotReloading.new'; | ||
| import {StrictMode} from './ReactTypeOfMode'; | ||
| import {StrictLegacyMode} from './ReactTypeOfMode'; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Chatted offline and we can follow up with this if we agree - we may want to name this something other than "legacy" since the term overloaded to mean "legacy root", "legacy strict mode" and any other "legacys" we have. I was thinking something like:
NoMode = 0StrictWarningMode = Level 1StrictRenderMode = Level 2StrictEffectMode = Level 3
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…y subtrees into strict mode level one ('mode == StrictModeL1'). This mode enables DEV-only double rendering, double component lifecycles, string ref warnings, legacy context warnings, etc. The primary purpose of this mode is to help detected render phase side effects. No new behavior. Roots created with experimental 'createRoot' and 'createBlockingRoot' APIs will also (for now) continue to default to strict mode level 1.
In a subsequent commit I will add support for a 'level' attribute on the '<React.StrictMode>' tag (as well as a new option supported by ). This will be the way to opt into strict mode level 2 ('mode == StrictModeL2'). This mode will enable DEV-only double invoking of effects on initial mount. This will simulate future Offscreen API semantics for trees being mounted, then hidden, and then shown again. The primary purpose of this mode is to enable applications to prepare for compatibility with the new Offscreen API (more information to follow shortly).
For now, this commit changes no public facing behavior. The only mechanism for opting into strict mode level 2 is the pre-existing 'enableDoubleInvokingEffects' feature flag (only enabled within Facebook for now).
StrictModeL1 -> StrictLegacyMode and StrictModeL2 -> StrictEffectsMode
11b8797 to
372bb8b
Compare
|
Merged via #20849 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.