-
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
[Flight] Unify plain Server Component and forwardRef under one function #28261
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
facebook-github-bot
added
CLA Signed
React Core Team
Opened by a member of the React Core Team
labels
Feb 6, 2024
gnoff
approved these changes
Feb 7, 2024
github-actions bot
pushed a commit
that referenced
this pull request
Feb 7, 2024
…on (#28261) This used to be trivial but it's no longer trivial. In Fizz and Fiber this is split into renderWithHooks and finishFunctionComponent since they also support indeterminate components. Interestingly thanks to this unification we always call functions with an arity of 2 which is a bit weird - with the second argument being undefined in everything except forwardRef and legacy context consumers. This makes Flight makes the same thing but we could also call it with an arity of 1. Since Flight errors early if you try to pass it a ref, and there's no legacy context, the second arg is always undefined. The practical change in this PR is that returning a Promise from a forwardRef now turns it into a lazy. We previously didn't support async forwardRef since it wasn't supported on the client. However, since eventually this will be supported by child-as-a-promise it seems fine to support it. DiffTrain build for [f07ac1e](f07ac1e)
huozhi
pushed a commit
to vercel/next.js
that referenced
this pull request
Feb 9, 2024
Updates React from 2bc7d336a to ba5e6a832. ### React upstream changes - facebook/react#28283 - facebook/react#28280 - facebook/react#28079 - facebook/react#28233 - facebook/react#28276 - facebook/react#28272 - facebook/react#28265 - facebook/react#28259 - facebook/react#28153 - facebook/react#28246 - facebook/react#28218 - facebook/react#28263 - facebook/react#28257 - facebook/react#28261 - facebook/react#28262 - facebook/react#28260 - facebook/react#28258 - facebook/react#27864 - facebook/react#28254 - facebook/react#28219 - facebook/react#28248 - facebook/react#28216 - facebook/react#28249 - facebook/react#28241 - facebook/react#28243 - facebook/react#28253 - facebook/react#28256 - facebook/react#28236 - facebook/react#28237 - facebook/react#28242 - facebook/react#28251 - facebook/react#28252 Closes NEXT-2411
EdisonVan
pushed a commit
to EdisonVan/react
that referenced
this pull request
Apr 15, 2024
…on (facebook#28261) This used to be trivial but it's no longer trivial. In Fizz and Fiber this is split into renderWithHooks and finishFunctionComponent since they also support indeterminate components. Interestingly thanks to this unification we always call functions with an arity of 2 which is a bit weird - with the second argument being undefined in everything except forwardRef and legacy context consumers. This makes Flight makes the same thing but we could also call it with an arity of 1. Since Flight errors early if you try to pass it a ref, and there's no legacy context, the second arg is always undefined. The practical change in this PR is that returning a Promise from a forwardRef now turns it into a lazy. We previously didn't support async forwardRef since it wasn't supported on the client. However, since eventually this will be supported by child-as-a-promise it seems fine to support it.
bigfootjon
pushed a commit
that referenced
this pull request
Apr 18, 2024
…on (#28261) This used to be trivial but it's no longer trivial. In Fizz and Fiber this is split into renderWithHooks and finishFunctionComponent since they also support indeterminate components. Interestingly thanks to this unification we always call functions with an arity of 2 which is a bit weird - with the second argument being undefined in everything except forwardRef and legacy context consumers. This makes Flight makes the same thing but we could also call it with an arity of 1. Since Flight errors early if you try to pass it a ref, and there's no legacy context, the second arg is always undefined. The practical change in this PR is that returning a Promise from a forwardRef now turns it into a lazy. We previously didn't support async forwardRef since it wasn't supported on the client. However, since eventually this will be supported by child-as-a-promise it seems fine to support it. DiffTrain build for commit f07ac1e.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This used to be trivial but it's no longer trivial.
In Fizz and Fiber this is split into renderWithHooks and finishFunctionComponent since they also support indeterminate components.
Interestingly thanks to this unification we always call functions with an arity of 2 which is a bit weird - with the second argument being undefined in everything except forwardRef and legacy context consumers.
This makes Flight makes the same thing but we could also call it with an arity of 1.
Since Flight errors early if you try to pass it a ref, and there's no legacy context, the second arg is always undefined.
The practical change in this PR is that returning a Promise from a forwardRef now turns it into a lazy. We previously didn't support async forwardRef since it wasn't supported on the client. However, since eventually this will be supported by child-as-a-promise it seems fine to support it.