Do not uncessarily fetch locales at first time you open/save settings menu

Locales would be fetched even if you simply open and save settings window (without changing any setting)
We now test it similarly we do on 2.2
Closes #11318
This commit is contained in:
Mario Jr 2021-02-20 11:47:46 -03:00
parent 6c5a0de107
commit d961dea594

View File

@ -55,9 +55,9 @@ class IntlStartup extends Component {
}
componentDidUpdate(prevProps) {
const { fetching, messages } = this.state;
const { fetching, messages, normalizedLocale } = this.state;
const { locale } = this.props;
const shouldFetch = (!fetching && _.isEmpty(messages)) || (locale !== prevProps.locale);
const shouldFetch = (!fetching && _.isEmpty(messages)) || ((locale !== prevProps.locale) && (normalizedLocale && (locale !== normalizedLocale)));
if (shouldFetch) this.fetchLocalizedMessages(locale);
}