]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
fix(devtools): display children with empty parent
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 22 Sep 2023 09:23:54 +0000 (11:23 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 22 Sep 2023 09:23:54 +0000 (11:23 +0200)
Fix posva/unplugin-vue-router#235

packages/router/src/devtools.ts

index c135a85b0b8610a44973cc6833ac0939ca0658c3..81760225baf37a1bafe884bb826991005d973e9c 100644 (file)
@@ -266,7 +266,13 @@ export function addDevtools(app: App, router: Router, matcher: RouterMatcher) {
         const payload = activeRoutesPayload
 
         // children routes will appear as nested
-        let routes = matcher.getRoutes().filter(route => !route.parent)
+        let routes = matcher.getRoutes().filter(
+          route =>
+            !route.parent ||
+            // these routes have a parent with no component which will not appear in the view
+            // therefore we still need to include them
+            !route.parent.record.components
+        )
 
         // reset match state to false
         routes.forEach(resetMatchStateOnRouteRecord)