Skip to content

Commit

Permalink
Remove textarea special case from child fiber (facebook#21222)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage authored and koto committed Jun 15, 2021
1 parent 4b32a82 commit 71ef5e1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
22 changes: 10 additions & 12 deletions packages/react-reconciler/src/ReactChildFiber.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
22 changes: 10 additions & 12 deletions packages/react-reconciler/src/ReactChildFiber.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 71ef5e1

Please sign in to comment.