SWR fetching infinite times on error #2368
Unanswered
shanemcgraw
asked this question in
Q&A
Replies: 1 comment 1 reply
-
@shanemcgraw Could you reproduce this on CodeSandbox? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm experiencing some strange behavior when SWR encounters a fetch error (both 2.0.0 and 2.0.1): an infinite request loop.
My fetcher is using axios with a simple setup:
...and I'm not using any other error handling config, just a straight up
useSWR(url, swrFetcher)
in my components. If a request fails (either 4XX or 5XX, or if I block it using the Chrome devtools network tab), SWR appears to go into an infinite loop of network calls until one of them returns a 200-level response (e.g. if I disable network blocking on the url).Am I missing something trivial? According to the docs, I thought there should be an exponential backoff. I've tried using
shouldRetryOnError
to disable retrying, but it still sends out the infinite loop of requests.(Using Next 12.1.0)
Beta Was this translation helpful? Give feedback.
All reactions