Skip to content

Commit

Permalink
feat: avoid refresh if new locale is already the current locale (#322)
Browse files Browse the repository at this point in the history
* feat: ✨ return if newLocale is already set

* feat: ✨ return if newLocale is already set

* refactor: ♻️ remove warning log
  • Loading branch information
moinulmoin authored Jan 1, 2024
1 parent 1bac288 commit b82abee
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export function createUseChangeLocale<LocalesKeys>(
}

return function changeLocale(newLocale: LocalesKeys) {
if (newLocale === currentLocale) return;

const importFnLocale = locales[newLocale as keyof typeof locales];

if (!importFnLocale) {
Expand Down

0 comments on commit b82abee

Please sign in to comment.