Updating 3.4.17 -> 3.5.5 causing weird behaviour with tests
See original GitHub issueIntended outcome:
- Update the package
Actual outcome:
- Tests started to fail with the following error:
Invariant Violation: client.watchQuery cannot be called with fetchPolicy set to "standby"
I narrowed it down to my components that are doing somethign like useQuery(query, {skip: whatever})
. If I hardcode skip to true, the invariant violation will pop up consistently, if I hardcode it to false, it goes away 😕
I also tried changing my approach to use useLazyQuery
instead of doing a skip approach, however with useLazyQuery
I get the invariant violation consistently 😢
I’m not explicitly using a fetch policy anywhere, just sticking to the default, so I have no idea why it would be complaining about a fetchPolicy thats set to ‘standby’.
This also happens when trying to update to version 3.5.0 instead of 3.5.5.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:15 (3 by maintainers)
Top Results From Across the Web
Changelog - Cypress Documentation
This previously resulted in unusual and undefined behavior. ... The cy.session() command now inherits the test isolation behavior for the suite it runs...
Read more >Changelog — pytest documentation
Bug Fixes¶. #10060: When running with --pdb , TestCase.tearDown is no longer called for tests when the class has been skipped via unittest.skip...
Read more >Robot Framework User Guide
Robot Framework is a Python-based, extensible keyword-driven automation framework for acceptance testing, acceptance test driven development (ATDD), behavior ...
Read more >pytest Documentation - Read the Docs
a single action can kick off multiple behaviors. pytest has a convenient way of ... will cause all tests using the fixture to...
Read more >VWO | #1 A/B Testing Tool in the World
VWO is the market-leading A/B testing tool that fast-growing companies use for experimentation & conversion rate optimization.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@dovalist It looks like you’re still using the
apollo-client
package (AC2). All AC3 versions of Apollo Client (3.0.0-3.5.5) are published to npm under the name@apollo/client
, just in case that’s useful to know. Given the version range identified by @meeoh (updating 3.4.17 to 3.5.5), I don’t think AC2 issues belong in this issue.Invariant Violation: client.watchQuery cannot be called with fetchPolicy set to “standby” at new InvariantError (/Users/rms/WebstormProjects/dovalist/hotels/node_modules/apollo-client/node_modules/ts-invariant/lib/invariant.js:16:28) at invariant (/Users/rms/WebstormProjects/dovalist/hotels/node_modules/apollo-client/node_modules/ts-invariant/lib/invariant.js:28:15) at QueryManager.watchQuery (/Users/rms/WebstormProjects/dovalist/hotels/node_modules/apollo-client/bundle.umd.js:1692:143) at ApolloClient.watchQuery (/Users/rms/WebstormProjects/dovalist/hotels/node_modules/apollo-client/bundle.umd.js:2572:32) at /Users/rms/WebstormProjects/dovalist/hotels/node_modules/@apollo/client/react/hooks/hooks.cjs:35:31 at useReducer (/Users/rms/WebstormProjects/dovalist/hotels/node_modules/react-dom/cjs/react-dom-server.node.development.js:1194:57) at Object.useState (/Users/rms/WebstormProjects/dovalist/hotels/node_modules/react-dom/cjs/react-dom-server.node.development.js:1132:10) at Object.useState (/Users/rms/WebstormProjects/dovalist/hotels/node_modules/react/cjs/react.development.js:1497:21) at useQuery (/Users/rms/WebstormProjects/dovalist/hotels/node_modules/@apollo/client/react/hooks/hooks.cjs:28:20) at useLazyQuery (/Users/rms/WebstormProjects/dovalist/hotels/node_modules/@apollo/client/react/hooks/hooks.cjs:265:18) at HotelListing (webpack-internal:///./pages/listing/index.jsx:110:75) at processChild (/Users/rms/WebstormProjects/dovalist/hotels/node_modules/react-dom/cjs/react-dom-server.node.development.js:3043:14) at resolve (/Users/rms/WebstormProjects/dovalist/hotels/node_modules/react-dom/cjs/react-dom-server.node.development.js:2960:5) at ReactDOMServerRenderer.render (/Users/rms/WebstormProjects/dovalist/hotels/node_modules/react-dom/cjs/react-dom-server.node.development.js:3435:22) at ReactDOMServerRenderer.read (/Users/rms/WebstormProjects/dovalist/hotels/node_modules/react-dom/cjs/react-dom-server.node.development.js:3373:29) at renderToString (/Users/rms/WebstormProjects/dovalist/hotels/node_modules/react-dom/cjs/react-dom-server.node.development.js:3988:27) { framesToPop: 1 }