Skip to content

Commit d27c5f3

Browse files
committed
Remove Warning: prefix and toString on console Arguments
1 parent d172bda commit d27c5f3

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

packages/react-dom-bindings/src/client/validateDOMNesting.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ function validateDOMNesting(
484484
// TODO: Format this as a linkified "diff view" with props instead of
485485
// a stack trace since the stack trace format is now for owner stacks.
486486
console['error'](
487-
'Warning: In HTML, %s cannot be a child of <%s>.%s\n' +
487+
'In HTML, %s cannot be a child of <%s>.%s\n' +
488488
'This will cause a hydration error.%s',
489489
tagDisplayName,
490490
ancestorTag,
@@ -498,7 +498,7 @@ function validateDOMNesting(
498498
// TODO: Format this as a linkified "diff view" with props instead of
499499
// a stack trace since the stack trace format is now for owner stacks.
500500
console['error'](
501-
'Warning: In HTML, %s cannot be a descendant of <%s>.\n' +
501+
'In HTML, %s cannot be a descendant of <%s>.\n' +
502502
'This will cause a hydration error.%s',
503503
tagDisplayName,
504504
ancestorTag,
@@ -530,7 +530,7 @@ function validateTextNesting(childText: string, parentTag: string): boolean {
530530
// TODO: Format this as a linkified "diff view" with props instead of
531531
// a stack trace since the stack trace format is now for owner stacks.
532532
console['error'](
533-
'Warning: In HTML, text nodes cannot be a child of <%s>.\n' +
533+
'In HTML, text nodes cannot be a child of <%s>.\n' +
534534
'This will cause a hydration error.%s',
535535
parentTag,
536536
getCurrentParentStackInDev(),
@@ -542,7 +542,7 @@ function validateTextNesting(childText: string, parentTag: string): boolean {
542542
// TODO: Format this as a linkified "diff view" with props instead of
543543
// a stack trace since the stack trace format is now for owner stacks.
544544
console['error'](
545-
'Warning: In HTML, whitespace text nodes cannot be a child of <%s>. ' +
545+
'In HTML, whitespace text nodes cannot be a child of <%s>. ' +
546546
"Make sure you don't have any extra whitespace between tags on " +
547547
'each line of your source code.\n' +
548548
'This will cause a hydration error.%s',

packages/shared/consoleWithStackDev.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ function printWarning(level, format, args, currentStack) {
4444
// When changing this logic, you might want to also
4545
// update consoleWithStackDev.www.js as well.
4646
if (__DEV__) {
47-
const isErrorLogger =
48-
format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n';
49-
5047
if (!supportsCreateTask && ReactSharedInternals.getCurrentStack) {
5148
// We only add the current stack to the console when createTask is not supported.
5249
// Since createTask requires DevTools to be open to work, this means that stacks
@@ -58,18 +55,7 @@ function printWarning(level, format, args, currentStack) {
5855
}
5956
}
6057

61-
if (isErrorLogger) {
62-
// Don't prefix our default logging formatting in ReactFiberErrorLoggger.
63-
// Don't toString the arguments.
64-
args.unshift(format);
65-
} else {
66-
// TODO: Remove this prefix and stop toStringing in the wrapper and
67-
// instead do it at each callsite as needed.
68-
// Careful: RN currently depends on this prefix
69-
// eslint-disable-next-line react-internal/safe-string-coercion
70-
args = args.map(item => String(item));
71-
args.unshift('Warning: ' + format);
72-
}
58+
args.unshift(format);
7359
// We intentionally don't use spread (or .apply) directly because it
7460
// breaks IE9: https://github.com/facebook/react/issues/13610
7561
// eslint-disable-next-line react-internal/no-production-logging

0 commit comments

Comments
 (0)