Following from vercel/swr#1574 and vercel/swr#1816, the shouldRetryOnError option can accept a function to conditionally determine if SWR should retry. The notes for Release 1.2.1 provide a basic usage example copied here.
useSWR(key, fetcher, {
shouldRetryOnError: (error) => {
// We skip retrying if the API is returning 404:
if (error.status === 404) return false
return true
}
})
Following from vercel/swr#1574 and vercel/swr#1816, the
shouldRetryOnError
option can accept a function to conditionally determine if SWR should retry. The notes for Release 1.2.1 provide a basic usage example copied here.As such, it would be very helpful if the Error Retry section of Error Handling and the Options section of API could be updated with this new usage.