Skip to content

@graphql-yoga/plugin-response-cache writes to cache when enabled(request) => false #3034

@klippx

Description

@klippx

Describe the bug

Yoga plugin-response-cache is writing to cache even for disabled requests (those that evaluate to enabled(request) => false)

Your Example Website or App

https://codesandbox.io/p/sandbox/awesome-lamarr-8st89p

Steps to Reproduce the Bug or Issue

  1. Go to graphiql
  2. Hit enter (this will query hello which has a @CacheControl directive, however, enabled() => false)
  3. Get result - but also server crashes (I put a fatal trap in cache.set just to prove that it gets invoked even though it shouldnt)

Expected behavior

As a user, when I make a query where response cache plugin is disabled (enabled() => false) I expect that cache get and set are NOT invoked!

Screenshots or Videos

N/A

Platform

  • OS: [*]
  • NodeJS: [*]
  • @envelop/response-cache: 5.3.2
  • @graphql-yoga/plugin-response-cache: 2.2.0
  • graphql-yoga: 4.0.5

Additional context

No response

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions