News for hackers. Stuff that matters.
Re:Two Weird Tricks with Redux by thom_nic on Wednesday April 13, 2016 @01:09PM (#11490087)
re: an action caller needing to wait on the async action to complete: I thought that was a non-issue. If you use redux-thunk and your action creator returns a promise, the caller gets it. So while you're no longer triggering off of a redux action/store state change -- which may or may not be seen as a good thing -- you can get the promise and add a `.then()` which will fire after the async action completes.

I put together a simple example here: https://gist.github.com/thom-nic/fbedf27a5222a8490aa9028a40b...

Basically: component fires a 'delete' action, and then does page navigation when delete is successful. (Not saying this is a good idea to do it that way, just that you can do it.) Or did I miss his point?

Re:Two Weird Tricks with Redux by dyscrete on Wednesday April 13, 2016 @01:11PM (#11490103)
You probably do not want to store a promise in state, it's not really serializable
Re:Two Weird Tricks with Redux by jlongster on Wednesday April 13, 2016 @01:24PM (#11490212)
My post says exactly this. Read the full thing. There are other cases where you do not have a reference to the promise. (think a function being called again at some indeterminate time)
Re:Two Weird Tricks with Redux by thom_nic on Wednesday April 13, 2016 @02:21PM (#11490823)
Ok, sorry for the misunderstanding - I'll re-read the post and see if I can understand the scenario you're describing.