Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memoizing of formatters when no locale is given. #47

Merged
merged 1 commit into from Jan 29, 2020

Conversation

rikkert
Copy link
Contributor

@rikkert rikkert commented Jan 29, 2020

Currently the get format functions are not pure so they can't be memoized.
I noticed this during SSR while formatting dates and amounts without passing a locale, like so:

{$_.date(new Date(), { format: 'full' }).toUpperCase()}

and

{$_.number(10.99, { format: 'EUR' })}

This caches the internally created formatter for all further requests.
On other requests, in a different language, locale.set('xx-YY') the incorrect language would be used for formatting.

@kaisermann
Copy link
Owner

Oh, nice catch! Thanks 🎉. Will release it soon

@kaisermann kaisermann merged commit 27871f9 into kaisermann:master Jan 29, 2020
@kaisermann
Copy link
Owner

Released in v2.3.1 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants