cancelQueries Promise doesn't resolve in Cypress/Storybook
Using the "Optimistic Updates" documentation, I created a mutation that uses
queryClient.cancelQueries({ queryKey: [myQueryKey] })
.
Running the app locally with a real backend behaves as expected.
However in both Cypress tests and in Storybook (both with HTTP requests mocked), the onMutate
function gets stuck on cancelQueries
, because the Promise never resolves.
Anyone have a clue what could be the problem here? I don't know if this is a problem with my implementation.1 Reply
national-goldOP•3y ago
Sorry for this one, found the issue. The
onSuccess
in the respective query was throwing an error due to a piece of invalid testing data used in both Cypress and Storybook.