Replies: 4 comments
-
you can use the error from swr result or using config callback const { mutate, error } = useSWR('foo', ()=>fetch('my link'), { onError: (error) => { console.log(error) } }) see: https://codesandbox.io/s/get-from-result-or-callback-02bxw1 |
Beta Was this translation helpful? Give feedback.
-
I think generally, we need to think again about our error APIs of |
Beta Was this translation helpful? Give feedback.
-
Good time of day! Facing the same issue. It sounds like it makes sense for To keep Thank you! |
Beta Was this translation helpful? Give feedback.
-
Oh, btw, I was speaking about unbounded mutate function... |
Beta Was this translation helpful? Give feedback.
-
Bug report
Description / Observed Behavior
If using mutate without parameters, mutate() always return data even if network has been shut down, the error can not be catch.
This is a pseudo-code example below. In this case, If refresh data when pull down, I can't display an error message to user.
Expected Behavior
I hope to get the error which was thrown while fetching in
catch
.Beta Was this translation helpful? Give feedback.
All reactions