Cypress tests failing after upgrading from react-query v3 to v5
I'm trying to upgrade to v5 of react-query, but I'm experiencing a weird issue where some of my e2e Cypress tests are no longer working. In these tests I am mocking data returned from an API. Running the tests with breakpoints, I can see in the network tab that the mocked data is correctly appearing in the response. However once the
Here's vaguely what my code looks like:
When I run the Cypress test the console looks like this:
If I run my app outside of Cypress using Vite, everything works fine. The console looks like this:
When I was on v3 on react-query my code looked like:
And running when Cypress the console looked like:
So to me it looks like my component isn't re-rendering when it should once it has received the data from the
I am using :
-
-
-
useQuery completes, the component doesn't re-render so the data variable is undefinedHere's vaguely what my code looks like:
When I run the Cypress test the console looks like this:
If I run my app outside of Cypress using Vite, everything works fine. The console looks like this:
When I was on v3 on react-query my code looked like:
And running when Cypress the console looked like:
So to me it looks like my component isn't re-rendering when it should once it has received the data from the
useQueryI am using :
-
"react": "^19.1.0"-
"@tanstack/react-query": "^5.76.1"-
"cypress": "^14.3.2"