Skip to content

Commit 8a4a59c

Browse files
authored
Remove textarea special case from child fiber (#21222)
1 parent bdc23c3 commit 8a4a59c

File tree

2 files changed

+20
-24
lines changed

2 files changed

+20
-24
lines changed

packages/react-reconciler/src/ReactChildFiber.new.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,16 @@ function coerceRef(
216216
}
217217

218218
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+
);
231229
}
232230

233231
function warnOnFunctionType(returnFiber: Fiber) {

packages/react-reconciler/src/ReactChildFiber.old.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,16 @@ function coerceRef(
216216
}
217217

218218
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+
);
231229
}
232230

233231
function warnOnFunctionType(returnFiber: Fiber) {

0 commit comments

Comments
 (0)