Skip to content

Commit 0be4cb1

Browse files
committed
Add locale to key to ensure data is refreshed when locale changes
1 parent 02a7d19 commit 0be4cb1

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

app/components/Sidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
const { locale } = useI18n()
3535
const localePath = useLocalePath()
3636
const main = useStore()
37-
const { data: navigation } = await useAsyncData('navigation', () => {
37+
const { data: navigation } = await useAsyncData('navigation' + locale.value, () => {
3838
return queryCollectionNavigation('content_' + locale.value)
3939
}, {
4040
watch: [locale], // Refetch when locale changes

app/pages/[...slug].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const codelistPageName = computed(() => {
2626
})
2727
const codelist = computed(() => { return main.codelists.includes(codelistPageName.value) })
2828
29-
const { data: page } = await useAsyncData('page-' + slug.value, async () => {
29+
const { data: page } = await useAsyncData('page-' + slug.value + locale.value, async () => {
3030
// Build collection name based on current locale
3131
const collection = ('content_' + locale.value) as keyof Collections
3232
const content = await queryCollection(collection).path(slug.value).first()

0 commit comments

Comments
 (0)