Skip to content

Commit

Permalink
fix(theme-default): preserve url params when switching language (#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Dec 28, 2022
1 parent 666257a commit 941b2fe
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ecosystem/theme-default/src/client/components/NavbarItems.vue
Expand Up @@ -31,7 +31,6 @@ const useNavbarSelectLanguage = (): ComputedRef<ResolvedNavbarItem[]> => {
}
const currentPath = router.currentRoute.value.path
const currentFullPath = router.currentRoute.value.fullPath
const currentHash = router.currentRoute.value.hash
const languageDropdown: ResolvedNavbarItem = {
text: themeLocale.value.selectLanguageText ?? 'unknown language',
Expand Down Expand Up @@ -65,8 +64,8 @@ const useNavbarSelectLanguage = (): ComputedRef<ResolvedNavbarItem[]> => {
if (
router.getRoutes().some((item) => item.path === targetLocalePage)
) {
// try to keep current hash across languages
link = `${targetLocalePage}${currentHash}`
// try to keep current hash and params across languages
link = currentFullPath.replace(currentPath, targetLocalePage)
} else {
link = targetThemeLocale.home ?? targetLocalePath
}
Expand Down

0 comments on commit 941b2fe

Please sign in to comment.