Closed IGassmann closed 8 months ago
I mean, that's expected behavior as signing out and re-initializing the client forces us to re-evaluate the queries. You can however add pause: ifNoToken
to the useQuery
so they don't run when they are expected to return unauthorized due to i.e. a missing token. or not render anything if there is no auth-token which I think is something you most likely don't want
We still wanted to render children
to perform operations without authentication in certain cases.
We solved the issue by adding a retryExchange
after authExchange
.
Describe the bug
I have an app that uses Clerk and the
authExchange
for authentication.Whenever a user signs out, all
useQuery
hooks on the page return anUnauthorized
error for a brief moment before being redirected to the sign-in page.The user needs to be redirected before seeing any error caused by the sign-out.
Reproduction
https://github.com/IGassmann/urql-clerk-signout
Urql version
urql v4.0.6
Validations