Skip to content
Discussion options

You must be logged in to vote

retryOnMount can do this. from the docs:

retryOnMount: boolean
If set to false, the query will not be retried on mount if it contains an error. Defaults to true.

But, I would generally look at a different app setup, because if you do this, the queries will still be in error state. On approach would be to separate into authenticated an non-authenticated app and just render different components:

const userQuery = useQuery(...)

if (userQuery.isLoading) return 'loading ...'

if (userQuery.data) return <AuthenticatedApp />

return <NonAuthenticatedApp />

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@mikelerch
Comment options

Answer selected by mikelerch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants