chore: revert localize loadingComplete dependency in ValidateMixin

This commit is contained in:
jorenbroekema 2021-07-20 17:00:48 +02:00 committed by Thomas Allmer
parent db1ad6d236
commit dc543e40f0
2 changed files with 7 additions and 3 deletions

View file

@ -644,7 +644,6 @@ export const ValidateMixinImplementation = superclass =>
* @private * @private
*/ */
async __getFeedbackMessages(validators) { async __getFeedbackMessages(validators) {
await localize.loadingComplete;
let fieldName = await this.fieldName; let fieldName = await this.fieldName;
return Promise.all( return Promise.all(
validators.map(async validator => { validators.map(async validator => {

View file

@ -127,7 +127,6 @@ describe('Form Validation Integrations', () => {
} }
async updateLabel() { async updateLabel() {
await localize.loadingComplete;
this.label = localize.msg('test-default-label:label'); this.label = localize.msg('test-default-label:label');
} }
@ -143,8 +142,14 @@ describe('Form Validation Integrations', () => {
}, },
}); });
this.boundUpdateLabel = this.updateLabel.bind(this); this.boundUpdateLabel = this.updateLabel.bind(this);
this.boundUpdateLabel();
// localeChanged is fired AFTER localize has finished loading missing translations
// so no need to await localize.loadingComplete
localize.addEventListener('localeChanged', this.boundUpdateLabel); localize.addEventListener('localeChanged', this.boundUpdateLabel);
// Wait for it to complete when updating the label for the first time
await localize.loadingComplete;
this.boundUpdateLabel();
} }
} }
const elTagString = defineCE(DefaultLabelInput); const elTagString = defineCE(DefaultLabelInput);