❓ Discuss: Do we need to make actions synchronous again?
See original GitHub issuehttps://github.com/hardchor/electron-redux/issues/31 raised the point that actions fired are now async. This is a technical restriction of IPC and the approach we’ve chosen to send any actions to the main store first before fanning them out to the renderer store(s).
Whilst actions do therefore become async, they should still stay in order (so won’t have any effect on the redux state itself).
We could put in some effort to apply actions originating from the same process immediately, and then filter them out once they get replayed by the main store (to avoid duplicate actions), but that would add some complexity, so I guess the question is:
Has the asynchronicity of actions in electron-redux
caused you any problems so far? (bonus points for comments). Use 👍 or 👎
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:11 (5 by maintainers)
Top GitHub Comments
@matt-way Hi, redux being totally synchrone is more one of its limitations than a feature. You will need to invent your own patterns to solve this. Possible solution is to dispatch arrays. You then simply need a middleware very similar to thunk that handles arrays of actions instead of actions only (I think that’s even a classic example of redux middlware, there might be a lib for this). So the pattern for chained action would be:
Anyway order is never guaranteed when multithreading, so you definitely will rely on async patterns like priority queues, timestamps and so on.
@LucaColonnello As just discussed on slack (and for the benefit for everyone else), aliased actions is what you’re looking for!