You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have set up the useSWR hook in a Next.js application that is intended to continually refresh some API data. I was noticing that after some errors (502s technically, but any error is fine to reproduce) the refreshInterval: 2000 I had set wasn't being used anymore and only manually re-focusing the page would cause a revalidation/refresh of the data. Even then, the refreshInterval didn't not pick back up after the error went away.
I have also tried manually specifying an onErrorRetry method which did not change the outcome:
In my example sandbox application you can see that the request count rises to 4, hits the 5xx error on request 5, then will succeed to pull another single request but stops thereafter.
I might also note why I care about this scenario (continual refresh regardless of errors, interaction, etc) specifically is because this is a site loaded on a remote display that isn't interacted with.
I have set up the useSWR hook in a Next.js application that is intended to continually refresh some API data. I was noticing that after some errors (502s technically, but any error is fine to reproduce) the
refreshInterval: 2000
I had set wasn't being used anymore and only manually re-focusing the page would cause a revalidation/refresh of the data. Even then, therefreshInterval
didn't not pick back up after the error went away.I have also tried manually specifying an
onErrorRetry
method which did not change the outcome:Any guidance here would be much appreciated.
Expected Behavior
I was expecting the
refreshInterval
to be respected after the error retry logic was able to get a positive result again.Repro Steps / Code Example
https://codesandbox.io/s/gifted-gagarin-od5ut
Additional Context
SWR version 0.3.9
The text was updated successfully, but these errors were encountered: