goatslacker / goatslacker/alt

Add option to run emitChange through setImmediate

Open
#356 3 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.