Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
broyde opened this issue Apr 12, 2024 · 1 comment
Open

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

broyde opened this issue Apr 12, 2024 · 1 comment
Labels

Comments

@broyde
Copy link

broyde commented Apr 12, 2024

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

@jerelmiller
Copy link
Member

Hey @broyde!

Thanks for bringing this to our attention! It looks like we might need to run internal document transforms on the queries passed to MockLink to ensure they match. I don't have a timeline on a fix for this, but we'll take a look when we get to it. Again, thanks for reporting it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants