Skip to content
Discussion options

You must be logged in to vote

The only reason why useQuery has an enabled option is because you can't call it conditionally, as it's a hook. You can just wrap queryClient.prefetchQuery in an if statement and not call it instead.

Also, enabled is an Observer level property, and prefetchQuery doesn't create a QueryObserver - it just fetches data and puts into the cache once.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@anicioalexandre
Comment options

@suryaashish-tyke
Comment options

@TkDodo
Comment options

@tran-simon
Comment options

@TkDodo
Comment options

Answer selected by anicioalexandre
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
4 participants