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

response interceptor doesn't fire when results are loaded from cache #235

Closed
pwelter34 opened this issue Apr 10, 2020 · 3 comments · Fixed by #236
Closed

response interceptor doesn't fire when results are loaded from cache #235

pwelter34 opened this issue Apr 10, 2020 · 3 comments · Fixed by #236

Comments

@pwelter34
Copy link

Describe the bug
When cachePolicy: CachePolicies.CACHE_FIRST, the response interceptor doesn't get called when the results are read from cache, ie the second time its called.

⚠️ Make a Codesandbox ⚠️
I've tweaked the useFetch + + Request/Response Interceptors demo to reproduce.

https://codesandbox.io/s/usefetch-provider-requestresponse-interceptors-6zwmw

To Reproduce
Steps to reproduce the behavior:

  1. let page run first time
  2. after loaded, click re-fetch button
  3. data read from cache
  4. the data is not transformed using the response interceptor

Expected behavior

the response interceptor should be called even if the data is read from cache.

@alex-cory
Copy link
Collaborator

Great catch, I will take a look at this asap

@alex-cory
Copy link
Collaborator

I just need to write tests, and then I'll merge this bugfix.

@alex-cory
Copy link
Collaborator

alex-cory commented Apr 11, 2020

this is available in v1.0.1. If it doesn't work, just comment here and I'll reopen the issue.

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

Successfully merging a pull request may close this issue.

2 participants