From 3d19870b36ba3dbccedd088d0e216b548c98abe9 Mon Sep 17 00:00:00 2001 From: Amir Raminfar Date: Fri, 21 Jun 2024 12:04:22 -0700 Subject: [PATCH] chore: fixes bugs with auto switching of menu --- assets/components/HostMenu.vue | 12 ++++-------- assets/components/SideMenu.vue | 2 +- assets/pages/container/[id].vue | 4 ++++ assets/pages/merged/[name].vue | 4 ++++ 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/assets/components/HostMenu.vue b/assets/components/HostMenu.vue index ade80e34..a59f273f 100644 --- a/assets/components/HostMenu.vue +++ b/assets/components/HostMenu.vue @@ -170,18 +170,14 @@ const menuItems = computed(() => { const route = useRoute("/container/[id]"); -const updateHostForContainerRoute = (to: RouteLocationNormalizedLoaded) => { - if (to.name === "/container/[id]") { - const container = containerStore.findContainerById(to.params.id as string); +watchEffect(() => { + if (route.name === "/container/[id]") { + const container = containerStore.findContainerById(route.params.id); if (container) { setHost(container.host); } } -}; - -updateHostForContainerRoute(route); - -onBeforeRouteUpdate((to) => updateHostForContainerRoute(to)); +});