Skip to content

Commit 402ab6f

Browse files
author
Sebastian Silbermann
committed
bigint impl for title children
1 parent 1a425e3 commit 402ab6f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -2960,7 +2960,7 @@ function pushTitle(
29602960

29612961
if (Array.isArray(children) && children.length > 1) {
29622962
console.error(
2963-
'React expects the `children` prop of <title> tags to be a string, number, or object with a novel `toString` method but found an Array with length %s instead.' +
2963+
'React expects the `children` prop of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found an Array with length %s instead.' +
29642964
' Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert `children` of <title> tags to a single string value' +
29652965
' which is why Arrays of length greater than 1 are not supported. When using JSX it can be commong to combine text nodes and value nodes.' +
29662966
' For example: <title>hello {nameOfUser}</title>. While not immediately apparent, `children` in this case is an Array with length 2. If your `children` prop' +
@@ -2971,22 +2971,22 @@ function pushTitle(
29712971
const childType =
29722972
typeof child === 'function' ? 'a Function' : 'a Sybmol';
29732973
console.error(
2974-
'React expect children of <title> tags to be a string, number, or object with a novel `toString` method but found %s instead.' +
2974+
'React expect children of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found %s instead.' +
29752975
' Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert children of <title>' +
29762976
' tags to a single string value.',
29772977
childType,
29782978
);
29792979
} else if (child && child.toString === {}.toString) {
29802980
if (child.$$typeof != null) {
29812981
console.error(
2982-
'React expects the `children` prop of <title> tags to be a string, number, or object with a novel `toString` method but found an object that appears to be' +
2982+
'React expects the `children` prop of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found an object that appears to be' +
29832983
' a React element which never implements a suitable `toString` method. Browsers treat all child Nodes of <title> tags as Text content and React expects to' +
29842984
' be able to convert children of <title> tags to a single string value which is why rendering React elements is not supported. If the `children` of <title> is' +
29852985
' a React Component try moving the <title> tag into that component. If the `children` of <title> is some HTML markup change it to be Text only to be valid HTML.',
29862986
);
29872987
} else {
29882988
console.error(
2989-
'React expects the `children` prop of <title> tags to be a string, number, or object with a novel `toString` method but found an object that does not implement' +
2989+
'React expects the `children` prop of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found an object that does not implement' +
29902990
' a suitable `toString` method. Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert children of <title> tags' +
29912991
' to a single string value. Using the default `toString` method available on every object is almost certainly an error. Consider whether the `children` of this <title>' +
29922992
' is an object in error and change it to a string or number value if so. Otherwise implement a `toString` method that React can use to produce a valid <title>.',
@@ -3123,10 +3123,11 @@ function pushStartTitle(
31233123
} else if (
31243124
childForValidation != null &&
31253125
typeof childForValidation !== 'string' &&
3126-
typeof childForValidation !== 'number'
3126+
typeof childForValidation !== 'number' &&
3127+
typeof childForValidation !== 'bigint'
31273128
) {
31283129
console.error(
3129-
'A title element received a value that was not a string or number for children. ' +
3130+
'A title element received a value that was not a string or number or bigint for children. ' +
31303131
'In the browser title Elements can only have Text Nodes as children. If ' +
31313132
'the children being rendered output more than a single text node in aggregate the browser ' +
31323133
'will display markup and comments as text in the title and hydration will likely fail and ' +

0 commit comments

Comments
 (0)