From e22febb3f3b4fe9c8ad148b797af4f264efef271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Thu, 2 Dec 2021 14:09:41 +0100 Subject: [PATCH] :zap: Prevent race condition with headers --- packages/editor-ui/src/views/NodeView.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index ea9bebc35d..f1be77bb76 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -240,9 +240,6 @@ export default mixins( // TODO i18n: Remove next line console.log(`Switching locale from ${oldLocale} to ${newLocale}`); // eslint-disable-line no-console loadLanguage(newLocale); - - const headers = await this.restApi().getNodeTranslationHeaders(); - addHeaders(headers, this.$store.getters.defaultLocale); }, }, async beforeRouteLeave(to, from, next) { @@ -2569,6 +2566,11 @@ export default mixins( try { await Promise.all(loadPromises); + + if (this.defaultLocale !== 'en') { + const headers = await this.restApi().getNodeTranslationHeaders(); + addHeaders(headers, this.defaultLocale); + } } catch (error) { this.$showError( error,