Skip to content

Async action triggered even if middleware doesn't call next(action) #1582

Answered by markerikson
flefloch-payps asked this question in Q&A
Discussion options

You must be logged in to vote

I'm not sure what you mean by "my action is still triggered and the API call is made". Can you clarify?

Note that thunks are completely different than actions. An action is a plain object with a type field. A thunk is a function:

https://redux.js.org/usage/writing-logic-thunks

So yes, if you dispatch a thunk, it will execute, and this middleware won't do anything to stop it.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@flefloch-payps
Comment options

@markerikson
Comment options

@flefloch-payps
Comment options

@markerikson
Comment options

@flefloch-payps
Comment options

Answer selected by flefloch-payps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants