From 4c55e7967bd1b336a33f45ff6d9aa980b470ca76 Mon Sep 17 00:00:00 2001 From: Ankeet Maini Date: Wed, 9 Nov 2016 15:16:53 +0530 Subject: [PATCH] Handles risky callbacks on setState. Fixes #8238 --- src/renderers/shared/fiber/ReactFiberUpdateQueue.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/renderers/shared/fiber/ReactFiberUpdateQueue.js b/src/renderers/shared/fiber/ReactFiberUpdateQueue.js index c3c8cf7904e2b..2e4312c65f086 100644 --- a/src/renderers/shared/fiber/ReactFiberUpdateQueue.js +++ b/src/renderers/shared/fiber/ReactFiberUpdateQueue.js @@ -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(); }