mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-10 21:54:47 +08:00
DevTools: fix mismatch between DOMNode childNodeCount and children
Expanding an ElementsTreeElement used to immediately set a populated flag to true before requesting getChildNodes(). If a ChildNodeCountUpdated event arrives before the children are set, we may call updateModifiedParentNode() and try to create visibleChildren when they are null, breaking the tree. This CL moves the place where 'populated' is set, so that updateModifiedParentNode() does not update tree children before they are available. Bug: 829884 Change-Id: Id68e71fb7a58336d781207b298a53354af3e5cfc Reviewed-on: https://chromium-review.googlesource.com/1049113 Commit-Queue: Erik Luo <luoe@chromium.org> Reviewed-by: Andrey Lushnikov <lushnikov@chromium.org> Reviewed-by: Joel Einbinder <einbinder@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#557132} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 2e5ad0a88b7d04fe1aac8b2fd0c26b2d3475e4c2
This commit is contained in:
@@ -287,7 +287,6 @@ Elements.ElementsTreeElement = class extends UI.TreeElement {
|
||||
* @override
|
||||
*/
|
||||
onpopulate() {
|
||||
this.populated = true;
|
||||
this.treeOutline.populateTreeElement(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -1154,7 +1154,10 @@ Elements.ElementsTreeOutline = class extends UI.TreeOutline {
|
||||
populateTreeElement(treeElement) {
|
||||
if (treeElement.childCount() || !treeElement.isExpandable())
|
||||
return;
|
||||
treeElement.node().getChildNodes(() => this._updateModifiedParentNode(treeElement.node()));
|
||||
treeElement.node().getChildNodes(() => {
|
||||
treeElement.populated = true;
|
||||
this._updateModifiedParentNode(treeElement.node());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user