Skip to content

MockLink doesn't work with @nonreactive directive. #11781

@broyde

Description

@broyde

Issue Description

The same query is used for main code and mocked response in test.
This works fine until we add @nonreactive directive to this query.
Query example:

const query = gql`
query TestQuery {
  photos {
    id
    url @nonreactive
  }
}
`;

Warning example:

     No more mocked responses for the query: query TestQuery {
        photos {
          id
          url
          __typename
        }
      }
      Expected variables: {}

Whole test: https://github.com/broyde/apollo-mock-nonreactive/blob/main/nonreactive.test.js

It would be great to automatically remove @nonreactive from mocks passed to MockLink/MockedProvider.
It should help to match actually performed query with the mocked one.

Link to Reproduction

https://github.com/broyde/apollo-mock-nonreactive

Reproduction Steps

No response

@apollo/client version

3.9.11

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions