question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

❓ Discuss: Do we need to make actions synchronous again?

See original GitHub issue

https://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:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
eric-burelcommented, Oct 11, 2018

@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:

  1. Generate an array of actions (taking conditions etc. into account)
  2. Dispatch the array

Anyway order is never guaranteed when multithreading, so you definitely will rely on async patterns like priority queues, timestamps and so on.

1reaction
hardchorcommented, Sep 19, 2017

@LucaColonnello As just discussed on slack (and for the benefit for everyone else), aliased actions is what you’re looking for!

Read more comments on GitHub >

github_iconTop Results From Across the Web

❓ Discuss: Do we need to make actions synchronous again ...
Local actions will be fired before non local action, which can be annoying in certain asyncrhonous process. If you wonder what use case...
Read more >
Synchronous and Asynchronous Actions - Micro Focus
The actions that you send to Media Server can be synchronous or asynchronous. Media Server does not respond to a synchronous action until...
Read more >
Asynchronous vs. Synchronous Programming: When to Use ...
In this blog post, we'll explore these two terms in greater depth to clarify when you should use async or sync processes when...
Read more >
Asynchronous vs. Synchronous Programming - Mendix
Async increases throughput because multiple operations can run at the same time. Sync is slower and more methodical.
Read more >
Breaking The Monolith III - Paprikati
In a monolith, communication is synchronous by default; now that we have multiple services we need to decide what to use.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found