[FIX] devtools: Fix crash when no root node

This commit fixes a crash in the retrieval of the components tree which
happened when the first app did not contain a root node. The default
inspected component is now set to be the first root component found in
the apps.
This commit is contained in:
Julien Carion (juca)
2023-07-06 11:43:32 +02:00
committed by Géry Debongnie
parent 8b1dc4c43d
commit 44748270da
@@ -1519,8 +1519,9 @@
}
}
}
// If nothing was found, return the first app's root component path
return ["0", "root"];
// If nothing was found, return the path of the first root component found in the apps
const appIndex = [...this.apps].findIndex((app) => app.root);
return [appIndex.toString(), "root"];
}
// Returns the tree of components of the inspected page in a parsed format
// Use inspectedPath to specify the path of the selected component