Monorepo
Monorepo copied to clipboard
refreshLocalesCache() does not refresh the correct cache keys
If I'm not mistaken, surveyform now uses keys of the form localeWithStrings_en-US_..., but refreshLocalesCache() does not seem to refresh them.
Ideally, we would:
- Rename all the
localeWithStrings_*keys so they start with the name of the app, in this casesurveyform_– this is so that we can safely delete cached data for one app with no risk of affecting the others. - Get rid of the current
surveyform_*andsurveyform_*_convertedkeys, which I think are not used bysurveyformanyway (double check that!) but still refreshed by that function.
First step on https://github.com/Devographics/Monorepo/pull/406
- I removed "localeConverted"
- I've added the appName to "localeWithStrings" using a pattern similar to other cache_keys
- I am using the cache key directly rather than loading the locale
Not yet done:
- I see keys like "surveyform_localeWithStrings_en-US_accounts,common,js2023,state_of_js,surveys". This is indeed incorrect, as locales should be loaded using a hiearchy, so "surveyform_localeWithStrings_en-US_accounts,common,surveys" for instance and then maybe the survey specific locales. That's probably a regression because the token optimization system was relying on page-level list of tokens, while previously I was relying on layouts, which allowed this kind of hierarchy. Will dig further.
- I need to remove calls to the older API to get rid of the old cache key, it may still be used
So still need a bit of cleanup before I close the issue but you can already merge the PR.
@SachaG should be ok for surveyform, it builds and do not seem to be buggy, you can test and merge #406
I've also cleaned up homepage and chart that were calling the deprecated "fetchLocale" method