-
In my application, users can navigate to To optimize this scenario, I've set Ideally, I would like to revalidate the data only when the item does exist, and skip the revalidation attempts when the item is not found. Is there a recommended approach or workaround within SWR to achieve this behavior? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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 },
); |
Beta Was this translation helpful? Give feedback.
Just remembered I kept this discussion open when I had already found the answer here: #1574 (comment)
It's as simple as: