You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The objective here is to conditionally show a different component if the error is in the first call or in the refresh mechanism, but in this case, the onRefresh is always false (initial state value) and does not get updated.
In the example i'm running, the first console.log shows the onRefresh as true, but inside the callbacks its value is always false.
The text was updated successfully, but these errors were encountered:
Bug report
onError callback not reflecting component state changes
Description / Observed Behavior
In a component using useState and useSwr, the state is not correctly propagated to the onError callback
Expected Behavior
The useState should be correctly accessible (read/write) inside the useSwr callbacks
Repro Steps / Code Example
The objective here is to conditionally show a different component if the error is in the first call or in the refresh mechanism, but in this case, the onRefresh is always false (initial state value) and does not get updated.
In the example i'm running, the first
console.log
shows theonRefresh
as true, but inside the callbacks its value is always false.The text was updated successfully, but these errors were encountered: