-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Refactor ReactDOMComponent to use flatter property operations #26433
Merged
sebmarkbage
merged 6 commits into
facebook:main
from
sebmarkbage:refactorreactdomcomponent
Mar 21, 2023
Merged
Refactor ReactDOMComponent to use flatter property operations #26433
sebmarkbage
merged 6 commits into
facebook:main
from
sebmarkbage:refactorreactdomcomponent
Mar 21, 2023
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
Mar 20, 2023
sebmarkbage
force-pushed
the
refactorreactdomcomponent
branch
3 times, most recently
from
March 20, 2023 04:19
2b64767
to
d5e5a65
Compare
sebmarkbage
force-pushed
the
refactorreactdomcomponent
branch
3 times, most recently
from
March 20, 2023 19:25
76e4906
to
4ad6e2d
Compare
These are now covered by switches inside each case.
This helps typos but it's unneccessarily clever.
This removes some runtime validation for the hydration path because we generally don't do this kind of validation against the props there. Only if the path ends up mismatching in the children somehow. This leads to some duplication but I plan on unifying later.
We actually only use this for BOOLEANs anyway.
sebmarkbage
force-pushed
the
refactorreactdomcomponent
branch
from
March 20, 2023 23:43
c5281c9
to
5396f17
Compare
I confirmed that the attribute-behavior fixture yields the same result as main (with the last fix included). |
acdlite
approved these changes
Mar 21, 2023
github-actions bot
pushed a commit
that referenced
this pull request
Mar 21, 2023
This is in line with the refactor I already did on Fizz earlier and brings Fiber up to a similar structure. We end up with a lot of extra checks due the extra abstractions we use to check the various properties. This uses a flatter and more inline model which makes it easier to see what each property does. The tradeoff is that a change might need changes in more places. The general structure is that there's a switch for tag first, then a switch for each attribute special case, then a switch for the value. So it's easy to follow where each scenario will end up and there shouldn't be any unnecessary code executed along the way. My goal is to eventually get rid of the meta-programming in DOMProperty and CSSProperty but I'm leaving that in for now - in line with Fizz. My next step is moving around things a bit in the diff/commit phases. This is the first step to more refactors for perf and size, but also because I'm adding more special cases so I need to have a flatter structure that I can reason about for those special cases. DiffTrain build for [520f7f3](520f7f3)
facebook-github-bot
pushed a commit
to facebook/react-native
that referenced
this pull request
Mar 29, 2023
Summary: This sync includes the following changes: - **[77ba1618a](facebook/react@77ba1618a )**: Bugfix: Remove extra render pass when reverting to client render ([#26445](facebook/react#26445)) //<Andrew Clark>// - **[520f7f3ed](facebook/react@520f7f3ed )**: Refactor ReactDOMComponent to use flatter property operations ([#26433](facebook/react#26433)) //<Sebastian Markbåge>// - **[0131d0cff](facebook/react@0131d0cff )**: Check if suspensey instance resolves in immediate task ([#26427](facebook/react#26427)) //<Andrew Clark>// Changelog: [General][Changed] - React Native sync for revisions 3554c88...77ba161 jest_e2e[run_all_tests] Reviewed By: poteto Differential Revision: D44476026 fbshipit-source-id: c6935d760a068672b714722dee1fd24839c08c4b
jeongshin
pushed a commit
to jeongshin/react-native
that referenced
this pull request
May 7, 2023
Summary: This sync includes the following changes: - **[77ba1618a](facebook/react@77ba1618a )**: Bugfix: Remove extra render pass when reverting to client render ([facebook#26445](facebook/react#26445)) //<Andrew Clark>// - **[520f7f3ed](facebook/react@520f7f3ed )**: Refactor ReactDOMComponent to use flatter property operations ([facebook#26433](facebook/react#26433)) //<Sebastian Markbåge>// - **[0131d0cff](facebook/react@0131d0cff )**: Check if suspensey instance resolves in immediate task ([facebook#26427](facebook/react#26427)) //<Andrew Clark>// Changelog: [General][Changed] - React Native sync for revisions 3554c88...77ba161 jest_e2e[run_all_tests] Reviewed By: poteto Differential Revision: D44476026 fbshipit-source-id: c6935d760a068672b714722dee1fd24839c08c4b
OlimpiaZurek
pushed a commit
to OlimpiaZurek/react-native
that referenced
this pull request
May 22, 2023
Summary: This sync includes the following changes: - **[77ba1618a](facebook/react@77ba1618a )**: Bugfix: Remove extra render pass when reverting to client render ([facebook#26445](facebook/react#26445)) //<Andrew Clark>// - **[520f7f3ed](facebook/react@520f7f3ed )**: Refactor ReactDOMComponent to use flatter property operations ([facebook#26433](facebook/react#26433)) //<Sebastian Markbåge>// - **[0131d0cff](facebook/react@0131d0cff )**: Check if suspensey instance resolves in immediate task ([facebook#26427](facebook/react#26427)) //<Andrew Clark>// Changelog: [General][Changed] - React Native sync for revisions 3554c88...77ba161 jest_e2e[run_all_tests] Reviewed By: poteto Differential Revision: D44476026 fbshipit-source-id: c6935d760a068672b714722dee1fd24839c08c4b
bigfootjon
pushed a commit
that referenced
this pull request
Apr 18, 2024
This is in line with the refactor I already did on Fizz earlier and brings Fiber up to a similar structure. We end up with a lot of extra checks due the extra abstractions we use to check the various properties. This uses a flatter and more inline model which makes it easier to see what each property does. The tradeoff is that a change might need changes in more places. The general structure is that there's a switch for tag first, then a switch for each attribute special case, then a switch for the value. So it's easy to follow where each scenario will end up and there shouldn't be any unnecessary code executed along the way. My goal is to eventually get rid of the meta-programming in DOMProperty and CSSProperty but I'm leaving that in for now - in line with Fizz. My next step is moving around things a bit in the diff/commit phases. This is the first step to more refactors for perf and size, but also because I'm adding more special cases so I need to have a flatter structure that I can reason about for those special cases. DiffTrain build for commit 520f7f3.
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 is in line with the refactor I already did on Fizz earlier and brings Fiber up to a similar structure.
We end up with a lot of extra checks due the extra abstractions we use to check the various properties. This uses a flatter and more inline model which makes it easier to see what each property does. The tradeoff is that a change might need changes in more places.
The general structure is that there's a switch for tag first, then a switch for each attribute special case, then a switch for the value. So it's easy to follow where each scenario will end up and there shouldn't be any unnecessary code executed along the way.
My goal is to eventually get rid of the meta-programming in DOMProperty and CSSProperty but I'm leaving that in for now - in line with Fizz.
My next step is moving around things a bit in the diff/commit phases. This is the first step to more refactors for perf and size, but also because I'm adding more special cases so I need to have a flatter structure that I can reason about for those special cases.