I was having the problem of “Query Keys Mapped to Action” returning an array with length 0, and was frustrated by the lack of answers online, so I wanted to share the solution I found.
I was setting the mapping context and using the “query keys mapped” function at the same time without realizing it. There must be a delay between setting the mapping context and calling the query function. I’m not sure why, since mapping contexts which haven’t even been added don’t have this problem. But adding a mapping context and calling the function simultaneously (or too quickly) will give an empty array.