Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 793 Bytes

File metadata and controls

53 lines (41 loc) · 793 Bytes

Do not use async actions

Rule no-async-actions

Using async actions can lead to memory leaks and application errors if you don't check for isDestroying and isDestroyed after each async step

Examples of incorrect code for this rule:

actions: {
  async handleClick() {
    // ...
  }
}
actions: {
  handleClick() {
    return something.then(() => { /* ... */ });
  }
}
@action
async handleClick() {
  // ...
}
@action
handleClick() {
  return something.then(() => { /* ... */ });
}

Examples of correct code for this rule:

actions: {
  handleClick() {
    return nothingOrSomethingThatIsNotAPromise;
  }
}

Further Reading