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, {}); + }); + }); }, );