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

shouldRetryOnError function usage not updated in "API" and "Error Handling" #559

Open
taesungh opened this issue Jan 10, 2024 · 1 comment

Comments

@taesungh
Copy link

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
  }
})

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.

@piotr-cz
Copy link

Yeah, without docs update it's an undocumented feature

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

No branches or pull requests

2 participants