Merge pull request #11443 from mariogasparoni/develop

Do not uncessarily fetch locales at first time you open/save settings menu
This commit is contained in:
Anton Georgiev 2021-02-23 09:31:24 -05:00 committed by GitHub
commit fc001a142c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);
}