x
This commit is contained in:
1 parent
6f67ee6077
commit
62db477dbd
13 files changed
+660
-98
No files matched your search
@@ -2,9 +2,19 @@
|
||||
import '../lib/i18n';
|
||||
import CartDrawer from './CartDrawer';
|
||||
import ScrollToTop from './ScrollToTop';
|
||||
import { ReactNode } from 'react';
|
||||
import { useEffect, type ReactNode } from 'react';
|
||||
import i18n from '../lib/i18n';
|
||||
|
||||
export default function ClientProviders({ children }: { children: ReactNode }) {
|
||||
useEffect(() => {
|
||||
const savedLang = localStorage.getItem('homaroma_lang')
|
||||
|
||||
// Hydrate from the user's persisted language only after the first client render.
|
||||
if (savedLang && savedLang !== i18n.language) {
|
||||
void i18n.changeLanguage(savedLang)
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<ScrollToTop />
|
||||
|
||||
Reference in new issue
Block a user