Skip to content
0

katanakit-js / skipToken

Variable: skipToken ​

ts
const skipToken: unique symbol;

Defined in: node_modules/.bun/@tanstack+query-core@5.104.1/node_modules/@tanstack/query-core/build/modern/hydration-B9t5w6NC.d.ts:1038

Sentinel value that can be passed as a query's queryFn to conditionally disable the query (equivalent to enabled: false) while preserving full type inference for the query's data. Unlike enabled: false, a query disabled via skipToken cannot be triggered with refetch.

Example ​

ts
new QueryObserver(queryClient, {
  queryKey: ['post', postId],
  queryFn: postId != null ? () => fetchPost(postId) : skipToken,
})

Released under the MIT License.