-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
First of all, I love this library and the patterns you guys are using. 👍👍
I'm trying to use redux to build an isomorphic app. It's working beautifully so far, except that I need to figure out how to wait until my stores have loaded (on the server) before returning the initial page load. Ideally, the loading should take place in the stores themselves, but when I call dispatch(userActions.load())
, the store has to return the new state (i.e. return { ...state, loading: true };
), so it can't return a promise to wait for. dispatch()
returns the action passed to it for some reason. I'd really like something like...
dispatch(someAsyncAction, successAction, failureAction) => Promise
...where the promise doesn't resolve until one of the other two actions is dispatched.
Is that the sort of thing that could be enabled with the middleware pattern?
Am I totally off base and there's a simple way to do this already?
Thanks.