T
TanStack13mo ago
xenial-black

Does creating a client with default options merge options with individual options?

I want to make sure a specific cookie exists before any query is ran, so would specificing an enable option based on that, merge with individual query options? Or would individual query options override the enabled option?
2 Replies
narrow-beige
narrow-beige13mo ago
Pretty sure it's simply an override. Maybe something like this works?
const queryClient = useQueryClient()
const { data } = useQuery({
enabled: queryClient.defaultQueryOptions().enabled && somethingElse,
queryKey: [...],
queryFn: ...
})
const queryClient = useQueryClient()
const { data } = useQuery({
enabled: queryClient.defaultQueryOptions().enabled && somethingElse,
queryKey: [...],
queryFn: ...
})
xenial-black
xenial-blackOP13mo ago
Figured, okay thank you

Did you find this page helpful?