Skip to content
Source
Sign inSign up
TanStack/query

feat(vue-query): useInfiniteQuery options support maybe ref type #8956

Mergedaa900031(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/8956/headmerged by DamianOsipiuk(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 100 additions and 35 deletions.

x
0 of 2 viewed, 2 left
15 additions and 1 deletionpackages/vue-query/src/__tests__/useInfiniteQuery.test-d.tsxModified
View file
@@ -1,5 +1,5 @@
import { describe, expectTypeOf, it } from 'vitest'
-import { reactive } from 'vue-demi'
+import { computed, reactive } from 'vue-demi'
import { useInfiniteQuery } from '../useInfiniteQuery'
import { simpleFetcher } from './test-utils'
import type { InfiniteData } from '@tanstack/query-core'
@@ -81,4 +81,18 @@
expectTypeOf(query.error).toEqualTypeOf<Error>()
})
+​
+ it('should accept computed options', () => {
+ const options = computed(() => ({
+ queryKey: ['infiniteQuery'],
+ queryFn: simpleFetcher,
+ getNextPageParam: () => undefined,
+ initialPageParam: 0,
+ }))
+ const query = reactive(useInfiniteQuery(options))
+​
+ if (query.isSuccess) {
+ expectTypeOf(query.data).toEqualTypeOf<InfiniteData<string, unknown>>()
+ }
+ })
})