-
Notifications
You must be signed in to change notification settings - Fork 49.3k
Clarify that there's three different kinds of OffscreenProps #32838
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
Conversation
This is the internal data structure and not the public API.
// Note: These happen to have identical begin phases, for now. We shouldn't hold | ||
// ourselves to this constraint, though. If the behavior diverges, we should | ||
// fork the function. | ||
// This just works today because it has the same Props. |
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.
If we want to change the internal format of the OffscreenProps we just have to make the translation here.
Comparing: 3fbfb9b...699e4ae Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
ActivityProps - Public API LegacyHiddenProps - Public Legacy API OffscreenProps - Internal implementation detail
7540693
to
2ef0a4f
Compare
We should figure out where we should put all these types that are public API like ViewTransitionProps, SuspenseProps etc. They're currently untyped in Fizz.
@@ -645,8 +647,8 @@ function updateOffscreenComponent( | |||
current: Fiber | null, | |||
workInProgress: Fiber, | |||
renderLanes: Lanes, | |||
nextProps: OffscreenProps, |
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.
Just curious, what's the thinking here? Better for types?
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.
This is the implementation detail of both LegacyHidden AND OffscreenComponent which may have different prop types. I pass in both OffscreenProps and LegacyProps in here and so if we change them, then types will break and we'll not forget to bridge LegacyHidden.
Stacked on #32838. We don't always type the Props of built-ins. This adds typing for most of the built-ins. When we did type them, we used to put it in the `ReactFiber...Component` files but any public API like this can be implemented in other renderers too such as Fizz. So I moved them to `shared/ReactTypes` which is where we put other public API types (that are not already built-in to Flow). That way Fizz can import them and assert properly when it accesses the props.
Stacked on #32838. We don't always type the Props of built-ins. This adds typing for most of the built-ins. When we did type them, we used to put it in the `ReactFiber...Component` files but any public API like this can be implemented in other renderers too such as Fizz. So I moved them to `shared/ReactTypes` which is where we put other public API types (that are not already built-in to Flow). That way Fizz can import them and assert properly when it accesses the props. DiffTrain build for [c44e4a2](c44e4a2)
Stacked on #32838. We don't always type the Props of built-ins. This adds typing for most of the built-ins. When we did type them, we used to put it in the `ReactFiber...Component` files but any public API like this can be implemented in other renderers too such as Fizz. So I moved them to `shared/ReactTypes` which is where we put other public API types (that are not already built-in to Flow). That way Fizz can import them and assert properly when it accesses the props. DiffTrain build for [c44e4a2](c44e4a2)
ActivityProps - Public API
LegacyHiddenProps - Public Legacy API
OffscreenProps - Internal implementation detail