Skip to content

Commit

Permalink
Merge pull request #5193 from conorhastings/enqueue-callback-error
Browse files Browse the repository at this point in the history
update enqueueCallback invariant to more specifically denote type of passed callback
  • Loading branch information
jimfb committed Oct 16, 2015
2 parents ed7ab7b + 20ec78d commit 0fc8f6a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/renderers/shared/reconciler/ReactUpdateQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ var ReactUpdateQueue = {
invariant(
typeof callback === 'function',
'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
'`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
'isn\'t callable.'
'`setState`, `replaceState`, or `forceUpdate` with a callback of type ' +
'%s. A function is expected',
typeof callback === 'object' && Object.keys(callback).length && Object.keys(callback).length < 20 ?
typeof callback + ' (keys: ' + Object.keys(callback) + ')' : typeof callback
);
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);

Expand Down Expand Up @@ -139,8 +141,10 @@ var ReactUpdateQueue = {
invariant(
typeof callback === 'function',
'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
'`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
'isn\'t callable.'
'`setState`, `replaceState`, or `forceUpdate` with a callback of type ' +
'%s. A function is expected',
typeof callback === 'object' && Object.keys(callback).length && Object.keys(callback).length < 20 ?
typeof callback + ' (keys: ' + Object.keys(callback) + ')' : typeof callback
);
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
Expand Down

0 comments on commit 0fc8f6a

Please sign in to comment.