Skip to content

Commit

Permalink
fix: async race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinchappell committed Nov 21, 2024
1 parent 8379cf3 commit 26389a0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/lib/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -105,6 +103,7 @@ export class FormeoEditor {
}

this.render()
this.opts.onLoad?.(this)
})
}

Expand Down

0 comments on commit 26389a0

Please sign in to comment.