Skip to content

Commit d5007b0

Browse files
committed
fix: async race condition
1 parent 8379cf3 commit d5007b0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/lib/js/editor.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,11 @@ export class FormeoEditor {
7373

7474
promises.push(i18n.init({ ...this.opts.i18n, locale: window.sessionStorage?.getItem(SESSION_LOCALE_KEY) }))
7575

76-
if (this.opts.allowEdit) {
77-
promises.push(this.init())
78-
}
79-
8076
const resolvedPromises = await Promise.all(promises)
8177

82-
this.opts.onLoad?.(this)
78+
if (this.opts.allowEdit) {
79+
this.init()
80+
}
8381

8482
return resolvedPromises
8583
}
@@ -105,6 +103,7 @@ export class FormeoEditor {
105103
}
106104

107105
this.render()
106+
this.opts.onLoad?.(this)
108107
})
109108
}
110109

0 commit comments

Comments
 (0)