apollo-client: MockedProvider doesn't match queries with @client directive

I’m not sure that this ever worked, because this is the first time that I’ve tried using MockedProvider with the @client directive, but it seems off.

Intended outcome: Passing mocks to MockedProvider having the @client directive should match like regular queries.

Actual outcome: No more mocked responses for the query: QUERY

How to reproduce the issue: Just try to mock a query having the @client directive.

Versions

  System:
    OS: macOS 10.14.2
  Binaries:
    Node: 8.11.3 - ~/.nvm/versions/node/v8.11.3/bin/node
    Yarn: 1.7.0 - /usr/local/bin/yarn
    npm: 6.5.0 - ~/.nvm/versions/node/v8.11.3/bin/npm
  Browsers:
    Chrome: 71.0.3578.98
    Firefox: 63.0
    Safari: 12.0.2
  npmPackages:
    apollo-cache-inmemory: 1.3.12 => 1.3.12
    apollo-client: 2.5.0-alpha.10 => 2.5.0-alpha.10
    apollo-link: 1.2.6 => 1.2.6
    apollo-link-error: 1.1.5 => 1.1.5
    apollo-link-http: 1.5.9 => 1.5.9
    react-apollo: 2.2.4 => 2.2.4

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 18 (14 by maintainers)

Most upvoted comments

HI I wanted to add to this an issue I’m having.
I just upgraded to react-apollo 3.0.1 and @apollo/react-testing 3.0.1.

I also had to add "apollo-utilities": "^1.3.2" to my package.json in order to not get the error [TypeError: (0 , _apolloUtilities.removeClientSetsFromDocument) is not a function]

@hwillson Hello, just experienced this issue with @apollo/client@3.2.3 . I used MockedProvider from @apollo/client/testing

const Q = gql`
  query Users($page: Int) {
    users(page: $page) @client {
      data {
        id
        name
      }
      page
    }
  }

without @client everything is ok.

OK, makes sense. I can confirm that installing apollo-utilities@1.1.0-alpha.10 does correct the issue I was seeing. 👍

@jrr Sounds like a separate issue - if you could open a new issue for this, that would be great.