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
I am trying to implement login using swr, but if my login request fails 2 times in a row isValidating gets stuck and returns true even after the request alredy finished.
Expected behaviour:
I try to login with incorrect credentials
Login request fails
isValidating is set to false no matter how many times the request already failed
Current behaviour:
I try to login with incorrect credentials
Login request fails
isValidating is set to false
But if I try to login with incorrect credentials again
Login request fails
isValidating is not set to false anymore
@quietshu The issue seems to be related to dispatch being reassigned to () => null during cleanup , which gets called before useEffect runs the 2nd time round.
Is there any reason why it's being reassigned that way, and can that be safely removed? If so happy to make a PR for it. Wouldn't it make more sense to just use a plain function rather than useCallback in this case for dispatch?
I am trying to implement login using swr, but if my login request fails 2 times in a row
isValidating
gets stuck and returnstrue
even after the request alredy finished.Expected behaviour:
I try to login with incorrect credentials
Login request fails
isValidating is set to false no matter how many times the request already failed
Current behaviour:
I try to login with incorrect credentials
Login request fails
isValidating is set to false
But if I try to login with incorrect credentials again
Login request fails
isValidating is not set to false anymore
This is my login component (simplified):
The text was updated successfully, but these errors were encountered: