arthurfiorette / axios-cache-interceptor

📬 Small and efficient cache interceptor for axios. Etag, Cache-Control, TTL, HTTP headers and more!
https://axios-cache-interceptor.js.org
MIT License
703 stars 58 forks source link

Add a way to ignore CanceledError #922

Closed Wykks closed 1 month ago

Wykks commented 1 month ago

What happened?

Following https://github.com/arthurfiorette/axios-cache-interceptor/issues/665 It doesn't seems to be solved, as I have this exact issue. Is there a way to tell a-c-i to ignore CanceledError? Because currently if a request is cached but then the same request is done, but cancelled (because of react strict mode), the cache is deleted. Also, it seems harmless to keep the cache associated to a request, when it's cancelled, regardless of react strict mode. What do you think?

Also thanks for this great library!

axios-cache-interceptor version

1.6.0

Node / Browser Version

N/A

Axios Version

1.7.2

What storage is being used

Memory Storage

Relevant debugging log output

N/A
Wykks commented 1 month ago

Welp that should to it: https://axios-cache-interceptor.js.org/config/request-specifics#cache-staleiferror my bad

Wykks commented 1 month ago

Actually staleIfError is not called at all on cancelled request

arthurfiorette commented 1 month ago

Are you up to a PR?

remember to add unit tests :)