(chore): copy fix in <style> precedence error (#31524)
## Summary This fixes a typo in the error that gets reported when Float errors while hoisting a style tag that does not contain both `precedence` and `href`. There was a typo in _conflict_ and the last part of the sentence doesn't make sense. I assume it wasn't needed since the message already suggests moving the style tag to the head manually.
Zack Tanner committed
Nov 14, 2024 at 14:03 UTC
63cde684f5340b1ca73f6244501aac1c3d2c92a8
2 files changed
+3
-4
packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js
+2
-3
@@ -3142,10 +3142,9 @@ export function isHostHoistableType(
3142
console.error(
3143
'Cannot render a <style> outside the main document without knowing its precedence and a unique href key.' +
3144
' React can hoist and deduplicate <style> tags if you provide a `precedence` prop along with an `href` prop that' +
3145
- ' does not conflic with the `href` values used in any other hoisted <style> or <link rel="stylesheet" ...> tags. ' +
3145
+ ' does not conflict with the `href` values used in any other hoisted <style> or <link rel="stylesheet" ...> tags. ' +
3146
' Note that hoisting <style> tags is considered an advanced feature that most will not use directly.' +
3147
- ' Consider moving the <style> tag to the <head> or consider adding a `precedence="default"` and `href="some unique resource identifier"`, or move the <style>' +
3148
- ' to the <style> tag.',
3147
+ ' Consider moving the <style> tag to the <head> or consider adding a `precedence="default"` and `href="some unique resource identifier"`.',
3148
);
3149
}
3150
}
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
+1
-1
@@ -551,7 +551,7 @@ describe('ReactDOMFloat', () => {
551
);
552
await waitForAll([]);
553
}).toErrorDev([
554
- 'Cannot render a <style> outside the main document without knowing its precedence and a unique href key. React can hoist and deduplicate <style> tags if you provide a `precedence` prop along with an `href` prop that does not conflic with the `href` values used in any other hoisted <style> or <link rel="stylesheet" ...> tags. Note that hoisting <style> tags is considered an advanced feature that most will not use directly. Consider moving the <style> tag to the <head> or consider adding a `precedence="default"` and `href="some unique resource identifier"`, or move the <style> to the <style> tag.',
554
+ 'Cannot render a <style> outside the main document without knowing its precedence and a unique href key. React can hoist and deduplicate <style> tags if you provide a `precedence` prop along with an `href` prop that does not conflict with the `href` values used in any other hoisted <style> or <link rel="stylesheet" ...> tags. Note that hoisting <style> tags is considered an advanced feature that most will not use directly. Consider moving the <style> tag to the <head> or consider adding a `precedence="default"` and `href="some unique resource identifier"`.',
555
'In HTML, <style> cannot be a child of <html>.',
556
]);
557