Skip to content

Commit

Permalink
add "should" to option names
Browse files Browse the repository at this point in the history
  • Loading branch information
glasser committed Mar 15, 2019
1 parent 3d87fda commit 3476403
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ interface Options<TContext = Record<string, any>> {

// If this hook is defined and returns false, the plugin will not read
// responses from the cache.
readFromCache?(
shouldReadFromCache?(
requestContext: GraphQLRequestContext<TContext>,
): ValueOrPromise<boolean>;

// If this hook is defined and returns false, the plugin will not write the
// response to the cache.
writeToCache?(
shouldWriteToCache?(
requestContext: GraphQLRequestContext<TContext>,
): ValueOrPromise<boolean>;
}
Expand Down Expand Up @@ -198,7 +198,10 @@ export default function plugin(
// Note that we set up sessionId and baseCacheKey before doing this
// check, so that we can still write the result to the cache even if
// we are told not to read from the cache.
if (options.readFromCache && !options.readFromCache(requestContext)) {
if (
options.shouldReadFromCache &&
!options.shouldReadFromCache(requestContext)
) {
return null;
}

Expand All @@ -222,7 +225,10 @@ export default function plugin(
if (!isGraphQLQuery(requestContext)) {
return;
}
if (options.writeToCache && !options.writeToCache(requestContext)) {
if (
options.shouldWriteToCache &&
!options.shouldWriteToCache(requestContext)
) {
return;
}

Expand Down

0 comments on commit 3476403

Please sign in to comment.