mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-05 02:41:26 +00:00
Merge ac046a45d1 into cb83656718
This commit is contained in:
commit
b987d896ba
1 changed files with 5 additions and 1 deletions
|
|
@ -33,11 +33,15 @@ export const TranslationProvider: React.FC<{ children: ReactNode }> = ({ childre
|
||||||
}, [i18n, extensionState.language])
|
}, [i18n, extensionState.language])
|
||||||
|
|
||||||
// Memoize the translation function to prevent unnecessary re-renders
|
// 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(
|
const translate = useCallback(
|
||||||
(key: string, options?: Record<string, any>) => {
|
(key: string, options?: Record<string, any>) => {
|
||||||
return i18n.t(key, options)
|
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 (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue