Skip to content

Commit

Permalink
fix: missing async await for state.evaluate promise
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenrui committed Feb 27, 2024
1 parent 7e018d6 commit bcb1765
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class Mini {
this._initEntities()
this._initializeGlobalVariables()
Events.applyEvents()
this.state.evaluate()
await this.state.evaluate()
this.observer.init()
const endTime = performance.now()
const executionTime = endTime - startTime
Expand Down
4 changes: 2 additions & 2 deletions lib/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ export class State {
this.attachVariableHelpers([varName], entityID)
}

evaluate() {
async evaluate() {
const promises = []

Array.from(this.entities.values()).forEach((entity) => {
promises.push(entity.attributes.evaluate())
})

await Promise.all(promises)

this.attachVariableHelpers(Array.from(this.variables.keys()))
this.shouldUpdate = true
}
Expand Down

0 comments on commit bcb1765

Please sign in to comment.