Fix nodeName comparison in insertStylesheetIntoRoot
Summary
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
Hi @sweetliquid!
Thank you for your pull request and welcome to our community.
Action Required
In 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.
Process
In 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 CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.
If you have received this in error or have any questions, please contact us at [email protected]. Thanks!
Comparing: 703983426243422d9726ca3a0c7eef54e173a6bb...8b3cf21547f953cf063898646331ae9cdd9d7429
Critical size changes
Includes critical production bundles, as well as any change greater than 2%:
| Name | +/- | Base | Current | +/- gzip | Base gzip | Current gzip |
|---|---|---|---|---|---|---|
| oss-stable/react-dom/cjs/react-dom.production.js | = | 6.66 kB | 6.66 kB | = | 1.82 kB | 1.82 kB |
| oss-stable/react-dom/cjs/react-dom-client.production.js | = | 494.06 kB | 494.06 kB | = | 88.22 kB | 88.22 kB |
| oss-experimental/react-dom/cjs/react-dom.production.js | = | 6.67 kB | 6.67 kB | = | 1.83 kB | 1.83 kB |
| oss-experimental/react-dom/cjs/react-dom-client.production.js | = | 498.86 kB | 498.86 kB | = | 88.93 kB | 88.93 kB |
| facebook-www/ReactDOM-prod.classic.js | = | 591.22 kB | 591.22 kB | = | 103.96 kB | 103.96 kB |
| facebook-www/ReactDOM-prod.modern.js | = | 567.44 kB | 567.44 kB | = | 100.36 kB | 100.36 kB |
| test_utils/ReactAllWarnings.js | Deleted | 64.26 kB | 0.00 kB | Deleted | 16.02 kB | 0.00 kB |
Significant size changes
Includes any change greater than 0.2%:
Expand to show
| Name | +/- | Base | Current | +/- gzip | Base gzip | Current gzip |
|---|---|---|---|---|---|---|
| test_utils/ReactAllWarnings.js | Deleted | 64.26 kB | 0.00 kB | Deleted | 16.02 kB | 0.00 kB |
Generated by :no_entry_sign: dangerJS against 8b3cf21547f953cf063898646331ae9cdd9d7429
If there are any problems, please guide me. Thanks!
@gnoff seems legit, and if not could we add a test that would fail this?
@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
@gnoff I've added back the nodeName check and fix it to uppercase, thanks for your explanation~