urql-graphql / urql

The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
https://urql.dev/goto/docs
MIT License
8.54k stars 444 forks source link

fix(graphcache): ignore current entity during invalidateType #3560

Closed JoviDeCroock closed 2 months ago

JoviDeCroock commented 2 months ago

Summary

After a conversation in Discord we discovered that an old "bug" is biting us with the new default functionality. The old bug goes as follows: when we invalidate in a mutation-updater and the invalidated entity belongs to the mutation response we effectively make the mutation response go to null due to us re-querying the data after our write, the re-querying happens so we respect resolvers for our mutation data.

This is an ad-hoc fix to reduce the impact of this change, we effectively exclude the entities we find in the mutation response so we can return a good response. In the future we might be able to establish a similar principle for custom invalidations/updates as well.

changeset-bot[bot] commented 2 months ago

🦋 Changeset detected

Latest commit: 8a9cceee07a83f161c4acd0585bc933ff859f160

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------------------------- | ----- | | @urql/exchange-graphcache | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR