mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #1022 from spicyj/multichild-throw
Refactor ReactMultiChild to not throw errors too
This commit is contained in:
+12
-10
@@ -215,6 +215,7 @@ var ReactMultiChild = {
|
||||
*/
|
||||
updateTextContent: function(nextContent) {
|
||||
updateDepth++;
|
||||
var errorThrown = true;
|
||||
try {
|
||||
var prevChildren = this._renderedChildren;
|
||||
// Remove any rendered children.
|
||||
@@ -225,13 +226,13 @@ var ReactMultiChild = {
|
||||
}
|
||||
// Set new text content.
|
||||
this.setTextContent(nextContent);
|
||||
} catch (error) {
|
||||
errorThrown = false;
|
||||
} finally {
|
||||
updateDepth--;
|
||||
updateDepth || clearQueue();
|
||||
throw error;
|
||||
if (!updateDepth) {
|
||||
errorThrown ? clearQueue() : processQueue();
|
||||
}
|
||||
}
|
||||
updateDepth--;
|
||||
updateDepth || processQueue();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -243,15 +244,16 @@ var ReactMultiChild = {
|
||||
*/
|
||||
updateChildren: function(nextNestedChildren, transaction) {
|
||||
updateDepth++;
|
||||
var errorThrown = true;
|
||||
try {
|
||||
this._updateChildren(nextNestedChildren, transaction);
|
||||
} catch (error) {
|
||||
errorThrown = false;
|
||||
} finally {
|
||||
updateDepth--;
|
||||
updateDepth || clearQueue();
|
||||
throw error;
|
||||
if (!updateDepth) {
|
||||
errorThrown ? clearQueue() : processQueue();
|
||||
}
|
||||
}
|
||||
updateDepth--;
|
||||
updateDepth || processQueue();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user