Skip to content

Commit 9f530fd

Browse files
authored
feat(tanstack): migrate vue query (#365)
* feat(tanstack): migrate vue query * addressing PR comments * fix infinite query
1 parent b9294bb commit 9f530fd

File tree

7 files changed

+538
-19
lines changed

7 files changed

+538
-19
lines changed

packages/clients/tanstack-query/package.json

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@
3232
"types": "./dist/react.d.cts",
3333
"default": "./dist/react.cjs"
3434
}
35+
},
36+
"./vue": {
37+
"import": {
38+
"types": "./dist/vue.d.ts",
39+
"default": "./dist/vue.js"
40+
},
41+
"require": {
42+
"types": "./dist/vue.d.cts",
43+
"default": "./dist/vue.cjs"
44+
}
45+
},
46+
"./package.json": {
47+
"import": "./package.json",
48+
"require": "./package.json"
3549
}
3650
},
3751
"dependencies": {
@@ -43,6 +57,7 @@
4357
},
4458
"devDependencies": {
4559
"@tanstack/react-query": "catalog:",
60+
"@tanstack/vue-query": "5.90.6",
4661
"@testing-library/dom": "^10.4.1",
4762
"@testing-library/react": "^16.3.0",
4863
"@types/react": "catalog:",
@@ -53,17 +68,18 @@
5368
"@zenstackhq/vitest-config": "workspace:*",
5469
"happy-dom": "^20.0.10",
5570
"nock": "^14.0.10",
56-
"react": "catalog:"
71+
"react": "catalog:",
72+
"vue": "catalog:"
5773
},
5874
"peerDependencies": {
5975
"@tanstack/react-query": "^5.0.0",
60-
"react": "^18 || ^19"
76+
"@tanstack/vue-query": "^5.0.0"
6177
},
6278
"peerDependenciesMeta": {
6379
"@tanstack/react-query": {
6480
"optional": true
6581
},
66-
"react": {
82+
"@tanstack/vue-query": {
6783
"optional": true
6884
}
6985
}

packages/clients/tanstack-query/src/react.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const QuerySettingsProvider = QuerySettingsContext.Provider;
7979
/**
8080
* React context provider for configuring query settings.
8181
*
82-
* @deprecated Use `QuerySettingsProvider` instead.
82+
* @deprecated Use {@link QuerySettingsProvider} instead.
8383
*/
8484
export const Provider = QuerySettingsProvider;
8585

@@ -473,7 +473,7 @@ export function useInternalMutation<
473473
options?: Omit<UseMutationOptions<Result, DefaultError, TArgs>, 'mutationFn'> & ExtraMutationOptions,
474474
checkReadBack?: C,
475475
) {
476-
const { endpoint, fetch } = useHooksContext();
476+
const { endpoint, fetch, logging } = useHooksContext();
477477
const queryClient = useQueryClient();
478478
const mutationFn = (data: any) => {
479479
const reqUrl =
@@ -493,7 +493,6 @@ export function useInternalMutation<
493493
const finalOptions = { ...options, mutationFn };
494494
const invalidateQueries = options?.invalidateQueries !== false;
495495
const optimisticUpdate = !!options?.optimisticUpdate;
496-
const { logging } = useContext(QuerySettingsContext);
497496

498497
if (operation) {
499498
if (invalidateQueries) {

packages/clients/tanstack-query/src/utils/common.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ export function unmarshal(value: string) {
208208
}
209209
}
210210

211-
export function makeUrl(url: string, model: string, operation: string, args?: unknown) {
212-
const baseUrl = `${url}/${lowerCaseFirst(model)}/${operation}`;
211+
export function makeUrl(endpoint: string, model: string, operation: string, args?: unknown) {
212+
const baseUrl = `${endpoint}/${lowerCaseFirst(model)}/${operation}`;
213213
if (!args) {
214214
return baseUrl;
215215
}

0 commit comments

Comments
 (0)