From 71ef5e1b95a8d373e8bc6740b540d1c1ca2ab3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Markb=C3=A5ge?= Date: Fri, 9 Apr 2021 17:02:13 -0400 Subject: [PATCH] Remove textarea special case from child fiber (#21222) --- .../src/ReactChildFiber.new.js | 22 +++++++++---------- .../src/ReactChildFiber.old.js | 22 +++++++++---------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/packages/react-reconciler/src/ReactChildFiber.new.js b/packages/react-reconciler/src/ReactChildFiber.new.js index 12a693c2d2d7a..e9fdf0b654b5a 100644 --- a/packages/react-reconciler/src/ReactChildFiber.new.js +++ b/packages/react-reconciler/src/ReactChildFiber.new.js @@ -216,18 +216,16 @@ function coerceRef( } function throwOnInvalidObjectType(returnFiber: Fiber, newChild: Object) { - if (returnFiber.type !== 'textarea') { - const childString = Object.prototype.toString.call(newChild); - invariant( - false, - 'Objects are not valid as a React child (found: %s). ' + - 'If you meant to render a collection of children, use an array ' + - 'instead.', - childString === '[object Object]' - ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' - : childString, - ); - } + const childString = Object.prototype.toString.call(newChild); + invariant( + false, + 'Objects are not valid as a React child (found: %s). ' + + 'If you meant to render a collection of children, use an array ' + + 'instead.', + childString === '[object Object]' + ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' + : childString, + ); } function warnOnFunctionType(returnFiber: Fiber) { diff --git a/packages/react-reconciler/src/ReactChildFiber.old.js b/packages/react-reconciler/src/ReactChildFiber.old.js index 52d941d19514a..34120a641ba3b 100644 --- a/packages/react-reconciler/src/ReactChildFiber.old.js +++ b/packages/react-reconciler/src/ReactChildFiber.old.js @@ -216,18 +216,16 @@ function coerceRef( } function throwOnInvalidObjectType(returnFiber: Fiber, newChild: Object) { - if (returnFiber.type !== 'textarea') { - const childString = Object.prototype.toString.call(newChild); - invariant( - false, - 'Objects are not valid as a React child (found: %s). ' + - 'If you meant to render a collection of children, use an array ' + - 'instead.', - childString === '[object Object]' - ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' - : childString, - ); - } + const childString = Object.prototype.toString.call(newChild); + invariant( + false, + 'Objects are not valid as a React child (found: %s). ' + + 'If you meant to render a collection of children, use an array ' + + 'instead.', + childString === '[object Object]' + ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' + : childString, + ); } function warnOnFunctionType(returnFiber: Fiber) {