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
I see the problem is that the cache key is generated from the entire options object, including the date itself. However, I'm unsure how to fix this because I don't know how to distinguish between a placeholder value and an option parameter.
@adrai I'm just leaving the computer. But your solution looks fine. I had the same idea in my head, but I was too lazy for searching correct field names :)
ok, current version 23.12.7 will only address this use case for simple t calls interpolating only 1 of these type of placeholders.... if that does still not work, then you need to keep the workaround until there's a better solution to this.
@adrai Ran into this issue as well which cost me some time to troubleshoot. In the end I've used a workaround suggested by @pepakriz .
Solution contains multiple strings that have more than 1 interpolation in them using formatters so even upgrading to the latest library version did not help. Would be great to see this fixed properly in the library so no workaround would be needed. If it's difficult to implement a fix maybe a flag could be added to config to disable the caching? Our solution doesn't really need that.
@OsvaldasRubavicius There is no good "fix" for it, feel free to suggest a PR. @pwolaq We may need to introduce a new init option that disables the caching of the in-built formats...
Activity
pepakriz commentedon Aug 15, 2024
I see the problem is that the cache key is generated from the entire options object, including the date itself. However, I'm unsure how to fix this because I don't know how to distinguish between a placeholder value and an option parameter.
adrai commentedon Aug 15, 2024
//cc @pwolaq
pepakriz commentedon Aug 15, 2024
I'd send a fix (remove cache), but there is already a public API around this feature (
addCached), so I don't know what to do.Because this mem leak is currently very critical for our use-case, we've introduced this workaround in our app:
try to address #2227 without the removal of cached formatter for in-b…
adrai commentedon Aug 15, 2024
please try with v23.12.4 I tried to address that, but this will only work if you don't pass some extra dynamic variables, like
faster: Math.random()pepakriz commentedon Aug 15, 2024
@adrai I'm just leaving the computer. But your solution looks fine. I had the same idea in my head, but I was too lazy for searching correct field names :)
I'll send a confirmation tomorrow.
Thank you!
pepakriz commentedon Aug 15, 2024
If I understand your fix correctly, it doesn't fix situations with more than one placeholder.
try to optimize last fix for #2227
adrai commentedon Aug 15, 2024
yes, but v23.12.6 should be even better ;-)
remove console.log statement #2227
revert last optimization to address #2227
adrai commentedon Aug 15, 2024
ok, current version 23.12.7 will only address this use case for simple t calls interpolating only 1 of these type of placeholders.... if that does still not work, then you need to keep the workaround until there's a better solution to this.
[Snyk] Upgrade i18next from 23.12.3 to 23.12.6 (#7132)
adrai commentedon Apr 12, 2025
stale... so closing for now...
OsvaldasRubavicius commentedon May 19, 2025
@adrai Ran into this issue as well which cost me some time to troubleshoot. In the end I've used a workaround suggested by @pepakriz .
Solution contains multiple strings that have more than 1 interpolation in them using formatters so even upgrading to the latest library version did not help. Would be great to see this fixed properly in the library so no workaround would be needed. If it's difficult to implement a fix maybe a flag could be added to config to disable the caching? Our solution doesn't really need that.
adrai commentedon May 19, 2025
@OsvaldasRubavicius There is no good "fix" for it, feel free to suggest a PR.
@pwolaq We may need to introduce a new init option that disables the caching of the in-built formats...
OsvaldasRubavicius commentedon May 19, 2025
@adrai thanks for a quick response. Having init option would work for us.
introduce `cacheInBuiltFormats` option to address #2227
adrai commentedon May 19, 2025
v25.2.0