Fix compat with StrictMode react 18

This commit is contained in:
garronej
2022-09-07 13:39:54 +02:00
parent 14db9cd523
commit a0be35db8b

View File

@ -83,8 +83,6 @@ export function __unsafe_useI18n<ExtraMessageKey extends string = never>(params:
return; return;
} }
let isMounted = true;
refHasStartedFetching.current = true; refHasStartedFetching.current = true;
(async () => { (async () => {
@ -144,10 +142,6 @@ export function __unsafe_useI18n<ExtraMessageKey extends string = never>(params:
})() })()
]).then(modules => modules.map(module => module.default)); ]).then(modules => modules.map(module => module.default));
if (!isMounted) {
return;
}
setI18n({ setI18n({
...createI18nTranslationFunctions({ ...createI18nTranslationFunctions({
"fallbackMessages": { "fallbackMessages": {
@ -180,10 +174,6 @@ export function __unsafe_useI18n<ExtraMessageKey extends string = never>(params:
) )
}); });
})(); })();
return () => {
isMounted = false;
};
}, []); }, []);
return i18n ?? null; return i18n ?? null;