From ac046a45d1d109ea1abb0944cdac297eebdd533e Mon Sep 17 00:00:00 2001 From: Roo Code Date: Fri, 30 Jan 2026 04:24:10 +0000 Subject: [PATCH] fix: add i18n.language to translate callback deps for React Compiler compatibility --- webview-ui/src/i18n/TranslationContext.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webview-ui/src/i18n/TranslationContext.tsx b/webview-ui/src/i18n/TranslationContext.tsx index 17f15450654..963ff7eecb1 100644 --- a/webview-ui/src/i18n/TranslationContext.tsx +++ b/webview-ui/src/i18n/TranslationContext.tsx @@ -33,11 +33,15 @@ export const TranslationProvider: React.FC<{ children: ReactNode }> = ({ childre }, [i18n, extensionState.language]) // Memoize the translation function to prevent unnecessary re-renders + // Note: i18n.language is included in deps because i18n is a singleton whose reference + // never changes, but we need to recreate the translate function when language changes + // to ensure React Compiler doesn't over-cache translation results const translate = useCallback( (key: string, options?: Record) => { return i18n.t(key, options) }, - [i18n], + // eslint-disable-next-line react-hooks/exhaustive-deps -- i18n.language triggers re-memoization when language changes + [i18n, i18n.language], ) return (