Simplify Root component by removing async i18n initialization
• Remove useState and useEffect hooks • Import i18n directly instead of async init • Eliminate loading state check
This commit is contained in:
parent
bc1a70bad0
commit
2d9334d35f
1 changed files with 7 additions and 22 deletions
|
|
@ -1,24 +1,9 @@
|
||||||
import { StrictMode, useEffect, useState } from 'react'
|
import { StrictMode } from 'react'
|
||||||
import { initializeI18n } from '@/i18n'
|
|
||||||
import App from '@/App'
|
import App from '@/App'
|
||||||
|
import '@/i18n'
|
||||||
|
|
||||||
export const Root = () => {
|
export const Root = () => (
|
||||||
const [isI18nInitialized, setIsI18nInitialized] = useState(false)
|
<StrictMode>
|
||||||
|
<App />
|
||||||
useEffect(() => {
|
</StrictMode>
|
||||||
// Initialize i18n immediately with persisted language
|
)
|
||||||
initializeI18n().then(() => {
|
|
||||||
setIsI18nInitialized(true)
|
|
||||||
})
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
if (!isI18nInitialized) {
|
|
||||||
return null // or a loading spinner
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<StrictMode>
|
|
||||||
<App />
|
|
||||||
</StrictMode>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue