Skip to content

Commit

Permalink
Handles risky callbacks on setState. Fixes facebook#8238
Browse files Browse the repository at this point in the history
  • Loading branch information
ankeetmaini committed Nov 9, 2016
1 parent 84b8bbd commit 4c55e79
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/renderers/shared/fiber/ReactFiberUpdateQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ exports.callCallbacks = function(queue : UpdateQueue, context : any) {
if (callback && !node.callbackWasCalled) {
node.callbackWasCalled = true;
if (typeof context !== 'undefined') {
callback.call(context);
try {
callback.call(context);
return null;
} catch (error) {
return error;
}
} else {
callback();
}
Expand Down

0 comments on commit 4c55e79

Please sign in to comment.