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): Replace default optional/required directive implementation #3341

Closed kitten closed 1 year ago

kitten commented 1 year ago

Summary

This replaces the default implementations for @_required and @_optional. These directives are now handled by checking for field._directives.required and field._directives.optional directly inside the readSelection logic.

This should enhance @_optional to also work on fields with selection sets properly.

Set of changes