Skip to content

Commit

Permalink
update enqueueCallback invariant to more specifically explain what ca…
Browse files Browse the repository at this point in the history
…used error
  • Loading branch information
conorhastings committed Oct 16, 2015
1 parent ed7ab7b commit 20ec78d
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 20ec78d

Please sign in to comment.