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.6k stars 448 forks source link

fix(graphcache): Fix info.partial edge case for @_optional #3340

Closed kitten closed 1 year ago

kitten commented 1 year ago

Summary

Note: It shouldn't currently be possible to trigger this edge case! However, I can't predict whether the code will change and cause us to create a case for this in the future, so changing this is the safest course of action.

When a field, hypothetically speaking, flips info.partial = true, but a parent field aborts with a cache miss, and a parent field then recovers by setting the value to null, then info.partial won't be reset to its prior value, which could've been false.

Set of changes