🩹(frontend) preload notifications translations to prevent flickering

The notifications namespace was being lazy-loaded when the first notification
appeared, causing a screen flicker during translation loading. Now preloading
the namespace during i18n initialization to ensure smooth rendering.
This commit is contained in:
lebaudantoine
2025-02-21 19:07:57 +01:00
committed by aleb_the_flash
parent 0a63270154
commit 0498a9e7f9

View File

@@ -12,6 +12,7 @@ import {
ANIMATION_DURATION,
ReactionPortals,
} from '@/features/rooms/livekit/components/ReactionPortal'
import { useTranslation } from 'react-i18next'
export const MainNotificationToast = () => {
const room = useRoomContext()
@@ -186,6 +187,10 @@ export const MainNotificationToast = () => {
}
}, [room])
// Without this line, when the component first renders,
// the 'notifications' namespace might not be loaded yet
useTranslation(['notifications'])
return (
<Div position="absolute" bottom={0} right={5} zIndex={1000}>
<ToastProvider />