Skip to content

Commit 5550ed4

Browse files
authored
Ensure arguments are coerced to strings in warnings (facebook#13385)
* Manually join extra attributes in warning This prevents a bug where Chrome reports `Array(n)` where `n` is the size of the array. * Prettier * Stringify all %s replaced symbols in warning * Eliminate extra string coercion * Pass args through with spread, convert all arguments to strings * Rename strings to stringArgs
1 parent 3938ccc commit 5550ed4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/shared/warningWithoutStack.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ if (__DEV__) {
2626
return;
2727
}
2828
if (typeof console !== 'undefined') {
29-
console.error('Warning: ' + format, ...args);
29+
const stringArgs = args.map(item => '' + item);
30+
console.error('Warning: ' + format, ...stringArgs);
3031
}
3132
try {
3233
// --- Welcome to debugging React ---

0 commit comments

Comments
 (0)