Omnistac / zedux

:zap: A Molecular State Engine for React
https://Omnistac.github.io/zedux/
MIT License
366 stars 7 forks source link

fix(react): prevent `controller.abort()` from isolating the `abort` fn #27

Closed bowheart closed 1 year ago

bowheart commented 1 year ago

Description

The optional chaining of the controller.abort('update') calls in injectPromise() are causing builds to extract the abort function to its own variable, losing the controller this scope when invoked. This causes an Illegal invocation error.

Use an if statement instead and change the type cast location to match the other controller.abort() call.