klarna / electron-redux

Use redux in the main and browser processes in electron
MIT License
743 stars 94 forks source link

Then-able dispatch? #257

Closed 5cript closed 3 years ago

5cript commented 3 years ago

Is there some way to get a then-able dispatch (promise)? Or something functionally similar without lots of caveats.

I often set the state and then do something with it, like saving a part of it to file. Or load a config and then use it in some fashion.

matmalkowski commented 3 years ago

Hey 👋

Might be wrong, since I'm new to the project, but the electron-redux doesn't change any redux related flow, or in that case the way how actions are dispatched on the store itself. This is only a middleware, that handles the sync between multiple stores in the app itself.

Sounds like in your case, you would like to have an action with some side effects - this has to do with redux itself and middleware that enables you to do so. Might be the thing that your are looking for is redux-thunk or redux-saga

Also please check out the redux docs on this as well, might be helpful: async actions

Let me know if that helps!

5cript commented 3 years ago

Thanks for the answer, I will try that when I get back to it (Its a hobby project).

I tried using two different redux-promise libs, but I ran into issues there, that I dont recall. Sorry if my response will take at least till weekend.

matmalkowski commented 3 years ago

I'm going to close the issue, since there is no activity