brianegan/redux_thunk

Result of Thunk not being returned from dispatch

fuzing opened this issue · 1 comments

Greetings and thank you for your work on this package.......

I was under the impression that dispatching a thunk action would return the value from the thunk, but I'm consistently receiving null.

e.g.

ThunkAction<AppState> someAction() {
    Future<void> abc(Store<AppState> store) async {
        await Future.delayed(Duration(seconds: 1));
        store.dispatch(OtherAction());
    };
    return abc;
}

var v = store.dispatch(someAction());
print(v);       // expecting v to be a Future<void>, but it's null instead
await v;       // awaiting null is a noop - never has intended effect

Am I incorrect here, or doing something wrong?

Thank you!

Problem lay with another middleware that was not returning the value from its call to next()

Thank you