From 6adfc3d8a93ae33279e5b9d5eff6db28d5014645 Mon Sep 17 00:00:00 2001 From: Konrad Mohrfeldt <konrad.mohrfeldt@farbdev.org> Date: Wed, 1 Nov 2023 22:53:09 +0100 Subject: [PATCH] refactor: let pages explicitly handle route parameter behaviour --- src/stores/shows.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/stores/shows.ts b/src/stores/shows.ts index 498a2a57..ba32d782 100644 --- a/src/stores/shows.ts +++ b/src/stores/shows.ts @@ -113,18 +113,10 @@ function useRouteSyncBehaviour( if (!oldShow) return const newShowId = show?.id ?? null const oldShowId = oldShow?.id ?? null - if (newShowId === oldShowId && newShowId === null) return + if (newShowId === oldShowId) return if (show && route.name && route.params.showId) { - if (Object.values(route.params).length === 1) { - // The route only contains the showId, so we can safely navigate to the same route - // but with a different show. - void router.replace({ name: route.name, params: { ...route.params, showId: newShowId } }) - } else { - // This route contains other parameters that may depend on the currently selected show. - // Navigate to the default show detail page instead. - void router.push({ name: 'show', params: { showId: newShowId } }) - } + void router.replace({ name: route.name, params: { ...route.params, showId: newShowId } }) } }) -- GitLab