diff --git a/presenter/renderer/+onRenderHtml.ts b/presenter/renderer/+onRenderHtml.ts
index 531125a3c2..df946f053c 100644
--- a/presenter/renderer/+onRenderHtml.ts
+++ b/presenter/renderer/+onRenderHtml.ts
@@ -1,7 +1,6 @@
import { renderToString as renderToString_ } from '@vue/server-renderer'
import { escapeInject, dangerouslySkipEscape } from 'vike/server'
import { PageContext, PageContextServer } from 'vike/types'
-import { resolveComponent } from 'vue'
import logoUrl from '#assets/favicon.ico'
import image from '#assets/img/dreammall-logo_social.png'
@@ -12,11 +11,6 @@ import { getDescription, getTitle } from './utils'
import type { App } from 'vue'
-// this fixes a warning which occurs when building
-// > "resolveComponent" is imported from external module "vue" but never used in ...
-// running this here fixes the warning and should not impact anything due to prerender setting.
-resolveComponent('nothing')
-
async function render(pageContext: PageContextServer & PageContext) {
const { app, i18n } = createApp(pageContext, false)
diff --git a/presenter/scripts/tests/mock.vikePageContext.ts b/presenter/scripts/tests/mock.vikePageContext.ts
index b52d8932a8..8bea3e2513 100644
--- a/presenter/scripts/tests/mock.vikePageContext.ts
+++ b/presenter/scripts/tests/mock.vikePageContext.ts
@@ -6,6 +6,7 @@ config.global.provide = {
...config.global.provide,
[vikePageContext as symbol]: {
urlPathname: '/some-url',
+ urlOriginal: '/original-url',
routeParams: {
code: 'my-code',
},
diff --git a/presenter/src/components/language/LanguageSelector.test.ts b/presenter/src/components/language/LanguageSelector.test.ts
index 788865856f..bdb9830ec8 100644
--- a/presenter/src/components/language/LanguageSelector.test.ts
+++ b/presenter/src/components/language/LanguageSelector.test.ts
@@ -1,10 +1,12 @@
import { mount } from '@vue/test-utils'
-import { describe, it, expect, beforeEach } from 'vitest'
-
-import i18n from '#plugins/i18n'
+import { navigate } from 'vike/client/router'
+import { describe, it, expect, beforeEach, vi } from 'vitest'
import LanguageSelector from './LanguageSelector.vue'
+vi.mock('vike/client/router')
+vi.mocked(navigate).mockResolvedValue()
+
describe('LanguageSelector', () => {
const Wrapper = () => {
return mount(LanguageSelector, {
@@ -29,7 +31,7 @@ describe('LanguageSelector', () => {
})
it('to en', () => {
- expect(i18n.global.locale.value).toBe('en')
+ expect(navigate).toHaveBeenCalledWith('/en/original-url')
})
})
})
diff --git a/presenter/src/components/language/LanguageSelector.vue b/presenter/src/components/language/LanguageSelector.vue
index f7ba35f7e3..3a094a1269 100644
--- a/presenter/src/components/language/LanguageSelector.vue
+++ b/presenter/src/components/language/LanguageSelector.vue
@@ -12,6 +12,7 @@
bg-color="transparent"
hide-details="auto"
flat
+ @update:model-value="updateLanguage"
>
{{ item.raw.locale.toUpperCase() }}
@@ -27,11 +28,26 @@