Skip to content

Commit

Permalink
Add safety guards around setting cache control headers in query (#2169)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesstelford authored Dec 30, 2019
1 parent 1d7f2e6 commit 05d07ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-wasps-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystonejs/keystone': patch
---

Ensure executeQuery() does not throw when a queried field has cache hint setttings
4 changes: 2 additions & 2 deletions packages/keystone/lib/List/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ module.exports = class List {
}

// Only static cache hints are supported at the field level until a use-case makes it clear what parameters a dynamic hint would take
if (field.config.cacheHint) {
if (field.config.cacheHint && info && info.cacheControl) {
info.cacheControl.setCacheHint(field.config.cacheHint);
}

Expand Down Expand Up @@ -1048,7 +1048,7 @@ module.exports = class List {
}

authenticatedQuery(context, info) {
if (info) {
if (info && info.cacheControl) {
info.cacheControl.setCacheHint({ scope: 'PRIVATE' });
}

Expand Down

0 comments on commit 05d07ad

Please sign in to comment.