Add option to run emitChange through setImmediate
Open
- Dominant language
- JavaScript
- Stars
- 3.4k
- Forks
- 312
- PR merge metrics
- No merged PRs in 30d
Description
There's a common use case where you do this in an action:
```
return somePromise.then(this.actions.success);
```
If a component re-renders with an error during `this.actions.success`, it gets swallowed by the promise. I've been telling people to use `.defer` so the next action occurs in a separate event loop, not in the promise.
The real issue is that stores are emitting changes synchronously, and we can get unrelated errors higher up. Assuming it wouldn't introduce bugs, can there be a config for making emitChange async? I tried React.addons.batchedUpdate, but it seemed smart enough to do it synchronously in a simple test.
Contributor guide
Assessment
This issue has not been assessed yet.