NPellet / visualizer

Other
42 stars 24 forks source link

context mixed up in code executor #1040

Closed stropitek closed 7 years ago

stropitek commented 7 years ago

In some views where I make heavy use of async await, I sometimes get a new value for this.action during the async execution

console.log(this.action.name) // ActionA
await myAsyncOperation();
console.log(this.action.name) // ActionB

I wasn't able to reproduce in a simple test case

stropitek commented 7 years ago

won't fix

Keep a seperate reference to the variable before making any asynchronous calls

let name = this.action.name;
await myAsyncOperation();
console.log(name);