fix: do not re-init active locale (#7329)

This commit is contained in:
Zach Pomerantz 2023-09-20 09:32:50 -07:00 committed by GitHub
parent 9672c2db9a
commit 7a981923f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

@ -10,6 +10,7 @@ i18n.load(DEFAULT_LOCALE, DEFAULT_MESSAGES)
i18n.activate(DEFAULT_LOCALE)
export async function dynamicActivate(locale: SupportedLocale) {
if (i18n.locale === locale) return
try {
const catalog = await import(`locales/${locale}.js`)
// Bundlers will either export it as default or as a named export named default.

@ -78,8 +78,10 @@ const userSlice = createSlice({
state.selectedWallet = wallet
},
updateUserLocale(state, action) {
if (action.payload.userLocale !== state.userLocale) {
state.userLocale = action.payload.userLocale
state.timestamp = currentTimestamp()
}
},
updateUserSlippageTolerance(state, action) {
state.userSlippageTolerance = action.payload.userSlippageTolerance