diff --git a/ui/src/lib/features/navigation/sidebar/component.svelte b/ui/src/lib/features/navigation/sidebar/component.svelte index c2705d0e..70654595 100644 --- a/ui/src/lib/features/navigation/sidebar/component.svelte +++ b/ui/src/lib/features/navigation/sidebar/component.svelte @@ -43,6 +43,20 @@ return route }) } + + // If link was clicked, updating url, but path is a child route that is currently not renendered + // we need to toggle the submenu to show the child route + function updateOnLinkClicks(path: string) { + for (const route of routes) { + if (path.includes(route.path) && !toggleSubmenus[route.path]) { + toggleSubmenus[route.path] = true + } + } + } + + $: if ($page.url.pathname) { + updateOnLinkClicks($page.url.pathname) + }