From ffc6a5fe18ad4b8b6d6b1faa5cbc61c6ea5fd76b Mon Sep 17 00:00:00 2001 From: Zhang Qichuan Date: Thu, 11 Apr 2019 04:36:12 -0700 Subject: [PATCH] Fix issue 408 (#411) Summary: Fix https://github.com/facebook/flipper/issues/408 Pull Request resolved: https://github.com/facebook/flipper/pull/411 Reviewed By: danielbuechele Differential Revision: D14802001 Pulled By: jknoxville fbshipit-source-id: 5ce435c0c941a715f799c75a8e09dbf4983e9789 --- src/plugins/layout/Inspector.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/plugins/layout/Inspector.js b/src/plugins/layout/Inspector.js index 0c512a846..3aebb9fb2 100644 --- a/src/plugins/layout/Inspector.js +++ b/src/plugins/layout/Inspector.js @@ -82,12 +82,17 @@ export default class Inspector extends Component { }: { nodes: Array<{id: ElementID, children: Array}>, }) => { - this.getNodes( - nodes - .map(n => [n.id, ...(n.children || [])]) - .reduce((acc, cv) => acc.concat(cv), []), - {}, - ); + const ids = nodes + .map(n => [n.id, ...(n.children || [])]) + .reduce((acc, cv) => acc.concat(cv), []); + this.getNodes(ids, {}).then(nodes => { + nodes.forEach(node => { + // Check if there are new IDs in the children array, and call getNodes() + // if there are any + const cIds = node.children.filter(c => !this.elements()[c]); + this.getNodes(cIds, {}); + }); + }); }, );