useSWR onError and onErrorRetry changed behaviour in 1.1.0 #2192
Unanswered
GabrielNastase
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, and thanks for the effort to build this great library.
We have been observed the functionality of onError and onErrorRetry callbacks has changed in the minor 1.1.0
We have cases in our apps where we call useSWR with the same cache key for multiple times, sometimes just for reading data, other times for reading data and handling error scenarios.
Consider this simplified code
Before 1.1.0 ( before this commit specifically in 1.1.0-beta.4 ) , we could see that both callbacks of the both components were fired. And that is what we expected. In 1.1.0 and after we can see that just the first rendered hook will call back the onError or onErrorRetry
As we have an app with multiple independent panels in the same page, and we need to handle the onErrorRetry different from panel to panels ( often we don't need to handle at all in the first rendered hook ) how are we suppose to do it going forward?
Would be nice if it would have been the option to opt-in the behaviour pre 1.1.0
Beta Was this translation helpful? Give feedback.
All reactions