Skip to content
Source
Sign inSign up
TanStack/query

fix(vue-query): unwrap getter options in fetchQuery #11103

Openbyungsker(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/11103/headopened View on GitHub

Showing 3 changed files with 29 additions and 2 deletions.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/vue-query-fetch-query-getter-options.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+"@tanstack/vue-query": patch
+---
+​
+Unwrap getter function options passed to `queryClient.fetchQuery`.
14 additions and 0 deletionspackages/vue-query/src/__tests__/queryClient.test.tsModified
View file
@@ -339,6 +339,20 @@
queryKey: queryKeyUnref,
+​
+ it('should unwrap getter function options', () => {
+ const queryClient = new QueryClient()
+​
+ queryClient.fetchQuery(() => ({
+ queryKey: queryKeyRef,
+ queryFn: fn,
+ }))
+​
+ expect(QueryClientOrigin.prototype.fetchQuery).toHaveBeenCalledWith({
+ queryKey: queryKeyUnref,
+ queryFn: fn,
+ })
+ })
​
describe('query', () => {