When designing or documenting API options and callbacks, ensure the contract is exact, unambiguous, and type-safe.
false from refetchInterval, not by disabling the query if that impacts more than polling).mutationKey is required if it isn’t). Use narrower option types for wrappers (so unsupported options are rejected by TS rather than silently ignored).queryFn where only serializable values are allowed—call functions so arguments are safe.Example (control-flow precision):
useQuery({
queryKey: ['job', jobId],
queryFn: () => fetchJobStatus(jobId),
refetchInterval: (query) => {
if (query.state.data?.status === 'complete') return false
return 2000
},
})
Enter the URL of a public GitHub repository