Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #2700 ...
klippx opened this issue Sep 29, 2023 · 2 comments
Assignees

Comments

@klippx
Copy link
Contributor

klippx commented Sep 29, 2023

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

@klippx
Copy link
Contributor Author

klippx commented Sep 29, 2023

Related n1ru4l/envelop#1963

@klippx
Copy link
Contributor Author

klippx commented Oct 18, 2023

This is now working, verified with updated dependencies in a fork code sandbox here

@klippx klippx closed this as completed Oct 18, 2023
This was referenced May 7, 2024
This was referenced May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants