Skip to content

Can revalidation be disabled when an error is thrown? #2840

Closed Answered by alvvaro
alvvaro asked this question in Q&A
Discussion options

You must be logged in to vote

Just remembered I kept this discussion open when I had already found the answer here: #1574 (comment)

It's as simple as:

const swr = useSWR(
    key, fetcher, { shouldRetryOnError: (error) => error.status !== 404 },
);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by alvvaro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant