-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
@cacheControl(noDefaultMaxAge: true)
Previously, the cache control logic treats root fields and fields that return object or interface types which don't declare `maxAge` specially: they are treated as uncachable (`maxAge` 0) by default. You can change that 0 to a different number with the `defaultMaxAge` option, but you can't just make them work like scalars and not affect the cache policy at all. This PR introduces a new argument to the directive: `@cacheControl(noDefaultMaxAge: true)`. If this is specified on a root or object-returning or interface-returning field that does not specify its `maxAge` in some other way (on the return value's type or via `setCacheHint`), then the field is just ignored for the sake of calculating cache policy, instead of defaulting to `defaultMaxAge`. Note that scalar fields all of whose ancestors have no `maxAge` due to this feature are now treated similarly to scalar root fields. One use case for this could be in federation: `buildFederatedSchema` could add this directive to all `@external` fields. This addresses concerns from #4162 and #3559.
- Loading branch information
Showing
6 changed files
with
402 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.