Replies: 1 comment
-
I think that this could be resolved in one of two ways: A)
or B)
And add documentation that any error handling must be done at the call-site when calling |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Bug report
Description / Observed Behavior
Using
preload
https://swr.vercel.app/blog/swr-v2.en-US#preloading-dataWhen preloading resources that responds with 404 NotFound I see an
Uncaught (in promise)
error in the console.When fetching the same resource with
useSWR
the rejected promise is correctly handled and does not emit a console error.My code
The output
Expected Behavior
SWR
preload
should handle rejected promises and not let "Uncaught (in promise)" be logged to console.Repro Steps / Code Example
See this CodeSandbox that reproduces the issue.
Displays both the error logging behaviour of
preload
and the expected silent behaviour ofuseSWR
Additional Context
SWR version:
2.1.0
Beta Was this translation helpful? Give feedback.
All reactions