Skip to content

UnknownAction type in listenerMiddleware when using matcher #4018

Answered by EskiMojo14
medihack asked this question in Q&A
Discussion options

You must be logged in to vote

we're not really sure why, but for some reason the inference order broke in 2.0.

You can force the correct order by defining the matcher as a separate variable first:

const isSpecialAction = isAnyOf(refreshMenu, setSelectedItem);
startAppListening({
  matcher: isSpecialAction,
  effect: (action, listenerApi) => {
    const { specialData } = action.meta
  },
})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@medihack
Comment options

Answer selected by medihack
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