Skip to content

tanstack query integration doesn't handle skipToken correctly #495

@LouisHaftmann

Description

@LouisHaftmann

The current way of using skipToken defeats the purpose of using a symbol to skip queries.

Current incorrect usage:

const queryOptions = orpc.user.get.queryOptions({
  input: computed(() => ({ userId: props.userId! })), // have to use `!` here because can't use skipToken
})
useQuery({
  ...queryOptions,
  queryFn: computed(() => (props.userId ? queryOptions.queryFn : skipToken)),
})

Intended usage:

orpc.user.get.queryOptions({
  input: computed(() => (props.userId ? { userId: props.userId } : skipToken)),
})

Internally this would need to set queryFn to skipToken if skipToken is passed as input (tanstack docs)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions