You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
In my application I use static messages loaded from a json file together with dynamically loaded messages. When interacting with the application I noticed that changes to the messages don't propagate in the UI and the values returned from the t function returns by useTranslations seem to be cached. Here's a simplified snippet of what I am doing:
const{ data }=useGraphQL(dynamicI18nQueryDocument);constdynamicMessages=(data.i18nStrings??[]).reduce<Record<string,string>>((acc,{ key, en })=>({ ...acc,[key]: en}),{});constmergedMessages={ ...messages, ...dynamicMessages};return(<NextIntlClientProviderlocale={locale}messages={mergedMessages}>{children}</NextIntlClientProvider>);
When invalidating the GraphQL query I can confirm that the new values are in the context and available in the hooks such as useTranslations but the value returned by any t('variable') that has been changed is still the same because it's memoized somehow.
Describe the solution you'd like
I'd prefer if the translation function returned by useTranslations can be invalidated easily in those cases where values change or get added to the context because they are not reflected at the moment.
Describe alternatives you've considered
n/a
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
In my application I use static messages loaded from a json file together with dynamically loaded messages. When interacting with the application I noticed that changes to the messages don't propagate in the UI and the values returned from the
t
function returns byuseTranslations
seem to be cached. Here's a simplified snippet of what I am doing:When invalidating the GraphQL query I can confirm that the new values are in the context and available in the hooks such as
useTranslations
but the value returned by anyt('variable')
that has been changed is still the same because it's memoized somehow.Describe the solution you'd like
I'd prefer if the translation function returned by
useTranslations
can be invalidated easily in those cases where values change or get added to the context because they are not reflected at the moment.Describe alternatives you've considered
n/a
The text was updated successfully, but these errors were encountered: