mirror of
https://github.com/facebook/react.git
synced 2026-02-24 04:33:04 +00:00
Catch first error from setState updaters
This commit is contained in:
@@ -71,7 +71,7 @@ exports.addCallbackToQueue = function(queue : UpdateQueue, callback: Function) :
|
||||
|
||||
exports.callCallbacks = function(queue : UpdateQueue, context : any) : Error | null {
|
||||
let node : ?UpdateQueueNode = queue;
|
||||
let error = null;
|
||||
let firstError = null;
|
||||
while (node) {
|
||||
const callback = node.callback;
|
||||
if (callback && !node.callbackWasCalled) {
|
||||
@@ -82,13 +82,13 @@ exports.callCallbacks = function(queue : UpdateQueue, context : any) : Error | n
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
} catch (e) {
|
||||
error = e;
|
||||
} catch (error) {
|
||||
firstError = firstError || error;
|
||||
}
|
||||
}
|
||||
node = node.next;
|
||||
}
|
||||
return error;
|
||||
return firstError;
|
||||
};
|
||||
|
||||
exports.mergeUpdateQueue = function(queue : UpdateQueue, instance : any, prevState : any, props : any) : any {
|
||||
|
||||
Reference in New Issue
Block a user