From e6a9b1ff11e3224465c079503f6c279d394ead05 Mon Sep 17 00:00:00 2001 From: MathieuG-P Date: Tue, 12 Jul 2022 21:39:30 +0200 Subject: [PATCH] remove useMemo that cause some bugs --- src/renderer/hooks/use-translation.hook.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/renderer/hooks/use-translation.hook.ts b/src/renderer/hooks/use-translation.hook.ts index 74fceca6..7403516f 100644 --- a/src/renderer/hooks/use-translation.hook.ts +++ b/src/renderer/hooks/use-translation.hook.ts @@ -1,14 +1,11 @@ -import { useMemo } from "react"; import { I18nService } from "renderer/services/i18n.service" export function useTranslation(): (translationKey: string) => string{ - - const i18nService = I18nService.getInstance(); + + const i18nService = I18nService.getInstance(); - return (key: string) => { - return useMemo(() => { - const tranlatables = key.split(" "); - return tranlatables.map((key) => i18nService.translate(key)).join(" "); - }, [key, i18nService.currentLanguage]); - } + return (key: string) => { + const tranlatables = key.split(" "); + return tranlatables.map((key) => i18nService.translate(key)).join(" "); + } } \ No newline at end of file