Ensure arguments are coerced to strings in warnings (#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
Nathan Hunzaker committed
Aug 13, 2018 at 16:13 UTC
5550ed4a8f33ff562e807175b8f35a1f9e037670
1 file changed
+2
-1
packages/shared/warningWithoutStack.js
+2
-1
@@ -26,7 +26,8 @@ if (__DEV__) {
26
return;
27
}
28
if (typeof console !== 'undefined') {
29
- console.error('Warning: ' + format, ...args);
29
+ const stringArgs = args.map(item => '' + item);
30
+ console.error('Warning: ' + format, ...stringArgs);
31
}
32
try {
33
// --- Welcome to debugging React ---