Mike-Gibson / mock-apollo-client

Helps unit test components which use the Apollo Client.
MIT License
117 stars 15 forks source link

Strip @connection directive from identifiers #20

Closed paulgv closed 3 years ago

paulgv commented 3 years ago

Similar to https://github.com/apollographql/apollo-client/issues/2518

This changes the getIdentifiers method so that it properly strips out the @connection directive to match Apollo Client's cache.

These changes are targeted at the 0.x branch but there might be a need to backport them to the 1.x branch as well.

paulgv commented 3 years ago

@Mike-Gibson could you give this a look please? Excuse the lack of details as I'm somewhat short on time as I'm opening this PR. I'll try to provide more info later if necessary.

Note that these changes were made against the 0.4.0 tag, because that's the version we're using and with which we encountered some failures due to the @connection directive not being stripped. I couldn't find a 0.4.0 branch, so I left the target branch its default master value.

Mike-Gibson commented 3 years ago

Hi, thanks for creating the PR - it all looks good to me. Thanks for adding the tests. I created a 0.x release branch and updated the PR to target it and merged it. Will put a release out shortly.

Mike-Gibson commented 3 years ago

@paulgv I've published 0.5.0 to npm. Let me know if you have any issues. Thanks again for the PR 👍

paulgv commented 3 years ago

Thank you very much for the prompt review and merge @Mike-Gibson! I can confirm that upgrading to v0.5.0 fixes the errors we encountered with v0.4.0 🎉