feat(pat-date-picker): Cache the ajax call to retrieve i18n picker translations. #1208
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ref: scrum-2726
This implementation uses good ol'
store
module from@patternslib/patternslib/src/core/store
- it's still handy.However, we can spare us the
supported
query because the web storage is just supported in practice by all modern browsers since Firefox 2 etc.Testing FTW, I found a case where a unsuccessful call to an i18n URL led to an error.
NOTE: in a real environment where multiple instances are
initialized at once on the same page, before the ajax call has
been completed, each instance will do an AJAX call. After that,
when navigating to other pages with other date picker instance
the cached value should be used and no more AJAX calls should be
made.
It would be hard to work around this limitation and I think it's a tradeoff we can live with, right?