Remove textarea special case from child fiber (#21222)
Sebastian Markbåge committed
Apr 9, 2021 at 17:02 UTC
8a4a59c725a9cc2defafd7ea4d2ae46dadd1daec
2 files changed
+20
-24
packages/react-reconciler/src/ReactChildFiber.new.js
+10
-12
@@ -216,18 +216,16 @@ function coerceRef(
216
}
217
218
function throwOnInvalidObjectType(returnFiber: Fiber, newChild: Object) {
219
- if (returnFiber.type !== 'textarea') {
220
- const childString = Object.prototype.toString.call(newChild);
221
- invariant(
222
- false,
223
- 'Objects are not valid as a React child (found: %s). ' +
224
- 'If you meant to render a collection of children, use an array ' +
225
- 'instead.',
226
- childString === '[object Object]'
227
- ? 'object with keys {' + Object.keys(newChild).join(', ') + '}'
228
- : childString,
229
- );
230
- }
219
+ const childString = Object.prototype.toString.call(newChild);
220
+ invariant(
221
+ false,
222
+ 'Objects are not valid as a React child (found: %s). ' +
223
+ 'If you meant to render a collection of children, use an array ' +
224
+ 'instead.',
225
+ childString === '[object Object]'
226
+ ? 'object with keys {' + Object.keys(newChild).join(', ') + '}'
227
+ : childString,
228
+ );
229
}
230
231
function warnOnFunctionType(returnFiber: Fiber) {
packages/react-reconciler/src/ReactChildFiber.old.js
+10
-12
@@ -216,18 +216,16 @@ function coerceRef(
216
}
217
218
function throwOnInvalidObjectType(returnFiber: Fiber, newChild: Object) {
219
- if (returnFiber.type !== 'textarea') {
220
- const childString = Object.prototype.toString.call(newChild);
221
- invariant(
222
- false,
223
- 'Objects are not valid as a React child (found: %s). ' +
224
- 'If you meant to render a collection of children, use an array ' +
225
- 'instead.',
226
- childString === '[object Object]'
227
- ? 'object with keys {' + Object.keys(newChild).join(', ') + '}'
228
- : childString,
229
- );
230
- }
219
+ const childString = Object.prototype.toString.call(newChild);
220
+ invariant(
221
+ false,
222
+ 'Objects are not valid as a React child (found: %s). ' +
223
+ 'If you meant to render a collection of children, use an array ' +
224
+ 'instead.',
225
+ childString === '[object Object]'
226
+ ? 'object with keys {' + Object.keys(newChild).join(', ') + '}'
227
+ : childString,
228
+ );
229
}
230
231
function warnOnFunctionType(returnFiber: Fiber) {