N
Nuxt3mo ago
george.x.r

Language Switcher (i18n) does not update components

hello all, did anyone else came across an issue with the language switcher (https://i18n.nuxtjs.org/docs/guide/lang-switcher) not updating the navigation component and the footer component? I have it as part of my navigation bar and when I change the locale it updates it in the main page but not the components. this is the layout's structure. Inside the TheNavigation i have another component that includes the language switcher. <slot/> gets updated but the data in the <TheNavigation/> and <TheFooter/> do not. <template> <div class="relative mx-auto"> <nav> <TheNavigation /> </nav> <main> <slot /> </main> <TheFooter /> </div> </template>
5 Replies
Mike
Mike3mo ago
Can you show the code for TheFooter or TheNavigation?
george.x.r
george.x.rOP3mo ago
useRetrieveDataFind is a composable that uses useAsyncData to retrieve data from an API. it is the same composable that is being used to retrieve the data in the main pages as well and they get updated on language change
Mike
Mike3mo ago
so useRetrieveDataFind is dependent on locale? Try adding locale to watch params: https://nuxt.com/docs/api/composables/use-async-data#watch-params
Nuxt
useAsyncData · Nuxt Composables
useAsyncData provides access to data that resolves asynchronously in an SSR-friendly composable.
george.x.r
george.x.rOP3mo ago
tried that. still the same issue it is has something to do with the layout because when I add the TheNavigation component inside a page it updates automatically
Want results from more Discord servers?
Add your server