From 26389a085335b6f945fca1a523228b094a62b566 Mon Sep 17 00:00:00 2001 From: Kevin Chappell Date: Wed, 20 Nov 2024 18:55:37 -0800 Subject: [PATCH] fix: async race condition --- src/lib/js/editor.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/js/editor.js b/src/lib/js/editor.js index fc55be06..46b463fa 100644 --- a/src/lib/js/editor.js +++ b/src/lib/js/editor.js @@ -73,13 +73,11 @@ export class FormeoEditor { promises.push(i18n.init({ ...this.opts.i18n, locale: window.sessionStorage?.getItem(SESSION_LOCALE_KEY) })) - if (this.opts.allowEdit) { - promises.push(this.init()) - } - const resolvedPromises = await Promise.all(promises) - this.opts.onLoad?.(this) + if (this.opts.allowEdit) { + this.init() + } return resolvedPromises } @@ -105,6 +103,7 @@ export class FormeoEditor { } this.render() + this.opts.onLoad?.(this) }) }