Closed JoviDeCroock closed 4 months ago
Latest commit: 8125b32da472fcb71bb367e6b41494f5752b3550
The changes in this PR will be included in the next version bump.
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
Related to #3470
Summary
This starts tracking a mapping of
__typename
to a list ofentityKey
, this enables us to perform operations likeinvalidate('Todo')
which would invalidate everyentityKey
of theTodo
type.We add non-root typenames when going through the
write
operation and we clean up entities in the list when we are going throughgc
runs.In the future this can instruct us for operations where we can't derive an entity i.e. a create-mutation will invalidate all entities of its own type to ensure we don't run into stale values which leaves us with the scalar return case which won't automatically be handled.
The PR explicitly does not add the
updater
logic yet so we can see that the explicit API surface does not grow, we support more cases instead.Set of changes
__typename
to a list of keysinvalidate('Type')
andinavlidate({ __typename: 'Type' })
Questions
Should we support invalidating a full type with field and arguments i.e.
invalidate('Todo', 'author')
would go through everyTodo
key and explicitly invalidate theAuthor
field.Follow-ups
invalidate({__typename})