-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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
Fix nodeName to UPPERCASE in insertStylesheetIntoRoot #28255
Fix nodeName to UPPERCASE in insertStylesheetIntoRoot #28255
Conversation
Hi @sweetliquid! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Comparing: 7039834...8b3cf21 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
|
If there are any problems, please guide me. Thanks! |
@gnoff seems legit, and if not could we add a test that would fail this? |
56b1460
to
fca552b
Compare
@sweetliquid the nodeName check is a shortcut to avoid the attribute lookup on link tags since it will likely be slower than just reading the node name. You're right thought that this is currently non-functional. But let's just fix it to uppercase so we can avoid the attr read for the majority of tags we process this way |
fca552b
to
7c5c931
Compare
@gnoff I've added back the nodeName check and fix it to uppercase, thanks for your explanation~ |
7c5c931
to
8b3cf21
Compare
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated. |
bump |
## Summary <!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? --> <img width="518" alt="image" src="https://github.com/facebook/react/assets/18693190/6d12df76-7dae-403b-b486-4940992abe8d"> The condition `node.nodeName === 'link'` is always `false`, because `node.nodeName` is Uppercase in specification. And the condition `node.nodeName === 'LINK'` is unnecessary, because Fizz hoists tags when it's `media` attribute is `"not all"`, whether it is a `link` or a `style` (line 36): https://github.com/facebook/react/blob/18cbcbf783377c5a22277a63ae41af54504502e0/packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetExternalRuntime.js#L30-L44 https://github.com/facebook/react/blob/18cbcbf783377c5a22277a63ae41af54504502e0/packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineSource.js#L30-L44 DiffTrain build for [b75cc07](b75cc07)
**breaking change for canary users: Bumps peer dependency of React from `19.0.0-rc-206df66e-20240912` to `19.0.0-rc-a99d8e8d-20240916`** [diff facebook/react@206df66e...a99d8e8d](facebook/react@206df66...a99d8e8) <details> <summary>React upstream changes</summary> - facebook/react#30977 - facebook/react#30971 - facebook/react#30922 - facebook/react#30917 - facebook/react#30902 - facebook/react#30912 - facebook/react#30970 - facebook/react#30969 - facebook/react#30967 - facebook/react#30966 - facebook/react#30960 - facebook/react#30968 - facebook/react#30961 - facebook/react#28255 - facebook/react#30957 - facebook/react#30958 - facebook/react#30959 - facebook/react#30951 - facebook/react#30954 - facebook/react#30920 - facebook/react#30942 </details>
Summary
The condition
node.nodeName === 'link'
is alwaysfalse
, becausenode.nodeName
is Uppercase in specification. And the conditionnode.nodeName === 'LINK'
is unnecessary, because Fizz hoists tags when it'smedia
attribute is"not all"
, whether it is alink
or astyle
(line 36):react/packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetExternalRuntime.js
Lines 30 to 44 in 18cbcbf
react/packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineSource.js
Lines 30 to 44 in 18cbcbf