tanstack-query-callbacks 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +9 -1
- package/dist/core/index.d.cts +2 -1
- package/dist/core/index.d.mts +2 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.d.cts +3 -2
- package/dist/react/index.d.mts +3 -2
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.mjs +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.d.cts +4 -3
- package/dist/vue/index.d.mts +4 -3
- package/dist/vue/index.d.ts +4 -3
- package/dist/vue/index.mjs +2 -2
- package/package.json +48 -34
- package/react.d.ts +1 -1
- package/vue.d.ts +1 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) zhong666 <hi@zhong666.me>
|
|
3
|
+
Copyright (c) 2023-PRESENT zhong666 <hi@zhong666.me>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
[![bundle][bundle-src]][bundle-href]
|
|
6
6
|
[![coverage][coverage-src]][coverage-href]
|
|
7
7
|
|
|
8
|
+
[![npm peer dependency version - @tanstack/vue-query][peer-deps-tanstack-vue-query-src]][peer-deps-tanstack-vue-query-href]
|
|
9
|
+
[![npm peer dependency version - @tanstack/react-query][peer-deps-tanstack-react-query-src]][peer-deps-tanstack-react-query-href]
|
|
10
|
+
|
|
8
11
|
Use callbacks of query in the usual way, as before.
|
|
9
12
|
|
|
10
13
|
The tanstack/query has removed `onSuccess`, `onError` and `onSettled` from useQuery in v5. You can find more information in the [RFC](https://github.com/TanStack/query/discussions/5279).
|
|
@@ -30,6 +33,7 @@ pnpm add tanstack-query-callbacks
|
|
|
30
33
|
<script setup lang="ts">
|
|
31
34
|
import { useQuery } from '@tanstack/vue-query'
|
|
32
35
|
import { useQueryCallbacks } from 'tanstack-query-callbacks/vue'
|
|
36
|
+
|
|
33
37
|
const queryKey = ['foo']
|
|
34
38
|
const query = useQuery(queryKey, () => Promise.resolve('bar'))
|
|
35
39
|
useQueryCallbacks({
|
|
@@ -78,5 +82,9 @@ useQueryCallbacks({
|
|
|
78
82
|
[npm-downloads-href]: https://npmjs.com/package/tanstack-query-callbacks
|
|
79
83
|
[bundle-src]: https://img.shields.io/bundlephobia/minzip/tanstack-query-callbacks?style=flat&colorA=18181B&colorB=F0DB4F
|
|
80
84
|
[bundle-href]: https://bundlephobia.com/result?p=tanstack-query-callbacks
|
|
81
|
-
[coverage-src]: https://img.shields.io/codecov/c/gh/aa900031/tanstack-query-callbacks?
|
|
85
|
+
[coverage-src]: https://img.shields.io/codecov/c/gh/aa900031/tanstack-query-callbacks?logo=codecov&style=flat&colorA=18181B&colorB=F0DB4F
|
|
82
86
|
[coverage-href]: https://codecov.io/gh/aa900031/tanstack-query-callbacks
|
|
87
|
+
[peer-deps-tanstack-vue-query-src]: https://img.shields.io/npm/dependency-version/tanstack-query-callbacks/peer/@tanstack/vue-query?style=flat&colorA=18181B&colorB=F0DB4F
|
|
88
|
+
[peer-deps-tanstack-vue-query-href]: https://www.npmjs.com/package/@tanstack/vue-query
|
|
89
|
+
[peer-deps-tanstack-react-query-src]: https://img.shields.io/npm/dependency-version/tanstack-query-callbacks/peer/@tanstack/react-query?style=flat&colorA=18181B&colorB=F0DB4F
|
|
90
|
+
[peer-deps-tanstack-react-query-href]: https://www.npmjs.com/package/@tanstack/react-query
|
package/dist/core/index.d.cts
CHANGED
|
@@ -14,4 +14,5 @@ interface SubscribeQueryCallbacksProps<TQueryFnData, TError> extends QueryCallba
|
|
|
14
14
|
}
|
|
15
15
|
declare function subscribeQueryCallbacks<TQueryFnData = unknown, TError = unknown>({ queryClient, queryKey, onSuccess, onError, onSettled, }: SubscribeQueryCallbacksProps<TQueryFnData, TError>): () => void;
|
|
16
16
|
|
|
17
|
-
export {
|
|
17
|
+
export { subscribeQueryCallbacks };
|
|
18
|
+
export type { QueryCallbacks, QueryErrorHandler, QuerySettledHandler, QuerySuccessHandler, SubscribeQueryCallbacksProps };
|
package/dist/core/index.d.mts
CHANGED
|
@@ -14,4 +14,5 @@ interface SubscribeQueryCallbacksProps<TQueryFnData, TError> extends QueryCallba
|
|
|
14
14
|
}
|
|
15
15
|
declare function subscribeQueryCallbacks<TQueryFnData = unknown, TError = unknown>({ queryClient, queryKey, onSuccess, onError, onSettled, }: SubscribeQueryCallbacksProps<TQueryFnData, TError>): () => void;
|
|
16
16
|
|
|
17
|
-
export {
|
|
17
|
+
export { subscribeQueryCallbacks };
|
|
18
|
+
export type { QueryCallbacks, QueryErrorHandler, QuerySettledHandler, QuerySuccessHandler, SubscribeQueryCallbacksProps };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -14,4 +14,5 @@ interface SubscribeQueryCallbacksProps<TQueryFnData, TError> extends QueryCallba
|
|
|
14
14
|
}
|
|
15
15
|
declare function subscribeQueryCallbacks<TQueryFnData = unknown, TError = unknown>({ queryClient, queryKey, onSuccess, onError, onSettled, }: SubscribeQueryCallbacksProps<TQueryFnData, TError>): () => void;
|
|
16
16
|
|
|
17
|
-
export {
|
|
17
|
+
export { subscribeQueryCallbacks };
|
|
18
|
+
export type { QueryCallbacks, QueryErrorHandler, QuerySettledHandler, QuerySuccessHandler, SubscribeQueryCallbacksProps };
|
package/dist/react/index.cjs
CHANGED
package/dist/react/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Context } from 'react';
|
|
2
1
|
import { QueryKey, QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { Context } from 'react';
|
|
3
3
|
import { QueryCallbacks } from '../core/index.cjs';
|
|
4
4
|
import '@tanstack/query-core';
|
|
5
5
|
|
|
@@ -16,4 +16,5 @@ interface UseQueryCallbacksProps<TQueryFnData, TError> extends QueryCallbacks<TQ
|
|
|
16
16
|
}
|
|
17
17
|
declare function useQueryCallbacks<TQueryFnData = unknown, TError = unknown>(props: UseQueryCallbacksProps<TQueryFnData, TError>): void;
|
|
18
18
|
|
|
19
|
-
export {
|
|
19
|
+
export { useQueryCallbacks };
|
|
20
|
+
export type { UseQueryCallbacksProps };
|
package/dist/react/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Context } from 'react';
|
|
2
1
|
import { QueryKey, QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { Context } from 'react';
|
|
3
3
|
import { QueryCallbacks } from '../core/index.mjs';
|
|
4
4
|
import '@tanstack/query-core';
|
|
5
5
|
|
|
@@ -16,4 +16,5 @@ interface UseQueryCallbacksProps<TQueryFnData, TError> extends QueryCallbacks<TQ
|
|
|
16
16
|
}
|
|
17
17
|
declare function useQueryCallbacks<TQueryFnData = unknown, TError = unknown>(props: UseQueryCallbacksProps<TQueryFnData, TError>): void;
|
|
18
18
|
|
|
19
|
-
export {
|
|
19
|
+
export { useQueryCallbacks };
|
|
20
|
+
export type { UseQueryCallbacksProps };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Context } from 'react';
|
|
2
1
|
import { QueryKey, QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { Context } from 'react';
|
|
3
3
|
import { QueryCallbacks } from '../core/index.js';
|
|
4
4
|
import '@tanstack/query-core';
|
|
5
5
|
|
|
@@ -16,4 +16,5 @@ interface UseQueryCallbacksProps<TQueryFnData, TError> extends QueryCallbacks<TQ
|
|
|
16
16
|
}
|
|
17
17
|
declare function useQueryCallbacks<TQueryFnData = unknown, TError = unknown>(props: UseQueryCallbacksProps<TQueryFnData, TError>): void;
|
|
18
18
|
|
|
19
|
-
export {
|
|
19
|
+
export { useQueryCallbacks };
|
|
20
|
+
export type { UseQueryCallbacksProps };
|
package/dist/react/index.mjs
CHANGED
package/dist/vue/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const vueDemi = require('vue-demi');
|
|
4
3
|
const vueQuery = require('@tanstack/vue-query');
|
|
4
|
+
const vueDemi = require('vue-demi');
|
|
5
5
|
const core_index = require('../core/index.cjs');
|
|
6
6
|
require('@tanstack/query-core');
|
|
7
7
|
|
|
@@ -21,7 +21,7 @@ function useQueryCallbacks(props) {
|
|
|
21
21
|
unsubscribe();
|
|
22
22
|
});
|
|
23
23
|
},
|
|
24
|
-
{ immediate: true }
|
|
24
|
+
{ immediate: true, flush: "sync" }
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
|
package/dist/vue/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { MaybeRef } from 'vue-demi';
|
|
2
1
|
import { QueryKey, QueryClient } from '@tanstack/vue-query';
|
|
2
|
+
import { Ref } from 'vue-demi';
|
|
3
3
|
import { QueryCallbacks } from '../core/index.cjs';
|
|
4
4
|
import '@tanstack/query-core';
|
|
5
5
|
|
|
6
6
|
interface UseQueryCallbacksProps<TQueryFnData, TError> extends QueryCallbacks<TQueryFnData, TError> {
|
|
7
|
-
queryKey:
|
|
7
|
+
queryKey: QueryKey | Ref<QueryKey>;
|
|
8
8
|
/**
|
|
9
9
|
* QueryClient instance
|
|
10
10
|
*/
|
|
@@ -20,4 +20,5 @@ interface UseQueryCallbacksProps<TQueryFnData, TError> extends QueryCallbacks<TQ
|
|
|
20
20
|
}
|
|
21
21
|
declare function useQueryCallbacks<TQueryFnData = unknown, TError = unknown>(props: UseQueryCallbacksProps<TQueryFnData, TError>): void;
|
|
22
22
|
|
|
23
|
-
export {
|
|
23
|
+
export { useQueryCallbacks };
|
|
24
|
+
export type { UseQueryCallbacksProps };
|
package/dist/vue/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { MaybeRef } from 'vue-demi';
|
|
2
1
|
import { QueryKey, QueryClient } from '@tanstack/vue-query';
|
|
2
|
+
import { Ref } from 'vue-demi';
|
|
3
3
|
import { QueryCallbacks } from '../core/index.mjs';
|
|
4
4
|
import '@tanstack/query-core';
|
|
5
5
|
|
|
6
6
|
interface UseQueryCallbacksProps<TQueryFnData, TError> extends QueryCallbacks<TQueryFnData, TError> {
|
|
7
|
-
queryKey:
|
|
7
|
+
queryKey: QueryKey | Ref<QueryKey>;
|
|
8
8
|
/**
|
|
9
9
|
* QueryClient instance
|
|
10
10
|
*/
|
|
@@ -20,4 +20,5 @@ interface UseQueryCallbacksProps<TQueryFnData, TError> extends QueryCallbacks<TQ
|
|
|
20
20
|
}
|
|
21
21
|
declare function useQueryCallbacks<TQueryFnData = unknown, TError = unknown>(props: UseQueryCallbacksProps<TQueryFnData, TError>): void;
|
|
22
22
|
|
|
23
|
-
export {
|
|
23
|
+
export { useQueryCallbacks };
|
|
24
|
+
export type { UseQueryCallbacksProps };
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { MaybeRef } from 'vue-demi';
|
|
2
1
|
import { QueryKey, QueryClient } from '@tanstack/vue-query';
|
|
2
|
+
import { Ref } from 'vue-demi';
|
|
3
3
|
import { QueryCallbacks } from '../core/index.js';
|
|
4
4
|
import '@tanstack/query-core';
|
|
5
5
|
|
|
6
6
|
interface UseQueryCallbacksProps<TQueryFnData, TError> extends QueryCallbacks<TQueryFnData, TError> {
|
|
7
|
-
queryKey:
|
|
7
|
+
queryKey: QueryKey | Ref<QueryKey>;
|
|
8
8
|
/**
|
|
9
9
|
* QueryClient instance
|
|
10
10
|
*/
|
|
@@ -20,4 +20,5 @@ interface UseQueryCallbacksProps<TQueryFnData, TError> extends QueryCallbacks<TQ
|
|
|
20
20
|
}
|
|
21
21
|
declare function useQueryCallbacks<TQueryFnData = unknown, TError = unknown>(props: UseQueryCallbacksProps<TQueryFnData, TError>): void;
|
|
22
22
|
|
|
23
|
-
export {
|
|
23
|
+
export { useQueryCallbacks };
|
|
24
|
+
export type { UseQueryCallbacksProps };
|
package/dist/vue/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { inject, watch, unref } from 'vue-demi';
|
|
2
1
|
import { useQueryClient } from '@tanstack/vue-query';
|
|
2
|
+
import { inject, watch, unref } from 'vue-demi';
|
|
3
3
|
import { subscribeQueryCallbacks } from '../core/index.mjs';
|
|
4
4
|
import '@tanstack/query-core';
|
|
5
5
|
|
|
@@ -19,7 +19,7 @@ function useQueryCallbacks(props) {
|
|
|
19
19
|
unsubscribe();
|
|
20
20
|
});
|
|
21
21
|
},
|
|
22
|
-
{ immediate: true }
|
|
22
|
+
{ immediate: true, flush: "sync" }
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
25
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tanstack-query-callbacks",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
5
|
-
"packageManager": "pnpm@8.15.1",
|
|
4
|
+
"version": "0.2.2",
|
|
6
5
|
"author": "zhong666 <hi@zhong666.me>",
|
|
7
6
|
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/aa900031/tanstack-query-callbacks#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/aa900031/tanstack-query-callbacks.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/aa900031/tanstack-query-callbacks/issues"
|
|
14
|
+
},
|
|
8
15
|
"keywords": [
|
|
9
16
|
"tanstack",
|
|
10
17
|
"tanstack-query",
|
|
@@ -69,47 +76,54 @@
|
|
|
69
76
|
}
|
|
70
77
|
},
|
|
71
78
|
"devDependencies": {
|
|
72
|
-
"@aa900031/eslint-config": "^
|
|
73
|
-
"@release-it
|
|
74
|
-
"@tanstack/query-core": "^5.
|
|
75
|
-
"@tanstack/query-core-v4": "npm:@tanstack/query-core@^4.
|
|
76
|
-
"@tanstack/react-query": "^5.
|
|
77
|
-
"@tanstack/react-query-v4": "npm:@tanstack/react-query@^4.
|
|
78
|
-
"@tanstack/vue-query": "^5.
|
|
79
|
-
"@tanstack/vue-query-v4": "npm:@tanstack/vue-query@^4.
|
|
80
|
-
"@testing-library/react": "14.
|
|
81
|
-
"@testing-library/vue": "^8.0
|
|
82
|
-
"@tsconfig/node18": "^18.2.
|
|
83
|
-
"@types/node": "^18.19.
|
|
84
|
-
"@types/react": "^18.
|
|
85
|
-
"@types/react-dom": "^18.
|
|
86
|
-
"@vitest/coverage-istanbul": "^
|
|
87
|
-
"@vitest/ui": "^
|
|
79
|
+
"@aa900031/eslint-config": "^3.2.0",
|
|
80
|
+
"@aa900031/release-it-config": "^0.1.0",
|
|
81
|
+
"@tanstack/query-core": "^5.90.10",
|
|
82
|
+
"@tanstack/query-core-v4": "npm:@tanstack/query-core@^4.41.0",
|
|
83
|
+
"@tanstack/react-query": "^5.90.10",
|
|
84
|
+
"@tanstack/react-query-v4": "npm:@tanstack/react-query@^4.42.0",
|
|
85
|
+
"@tanstack/vue-query": "^5.91.2",
|
|
86
|
+
"@tanstack/vue-query-v4": "npm:@tanstack/vue-query@^4.41.0",
|
|
87
|
+
"@testing-library/react": "14.3.1",
|
|
88
|
+
"@testing-library/vue": "^8.1.0",
|
|
89
|
+
"@tsconfig/node18": "^18.2.5",
|
|
90
|
+
"@types/node": "^18.19.130",
|
|
91
|
+
"@types/react": "^18.3.26",
|
|
92
|
+
"@types/react-dom": "^18.3.7",
|
|
93
|
+
"@vitest/coverage-istanbul": "^3.2.4",
|
|
94
|
+
"@vitest/ui": "^3.2.4",
|
|
88
95
|
"@vue/composition-api": "^1.7.2",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"react": "^18.
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"vue": "
|
|
100
|
-
"vue-2": "npm:vue
|
|
101
|
-
|
|
96
|
+
"eslint": "^9.39.1",
|
|
97
|
+
"happy-dom": "^20.0.10",
|
|
98
|
+
"npm-run-all2": "^8.0.4",
|
|
99
|
+
"react": "^18.3.1",
|
|
100
|
+
"react-dom": "^18.3.1",
|
|
101
|
+
"release-it": "^19.0.6",
|
|
102
|
+
"typescript": "^5.9.3",
|
|
103
|
+
"unbuild": "^3.6.1",
|
|
104
|
+
"vitest": "^3.2.4",
|
|
105
|
+
"vue": "^3.5.24",
|
|
106
|
+
"vue-2": "npm:vue@~2.6.14",
|
|
107
|
+
"vue-2.7": "npm:vue@~2.7.16"
|
|
108
|
+
},
|
|
109
|
+
"resolutions": {
|
|
110
|
+
"vue-demi": "latest"
|
|
102
111
|
},
|
|
103
112
|
"scripts": {
|
|
104
113
|
"build": "unbuild",
|
|
105
|
-
"test": "vitest run
|
|
114
|
+
"test": "vitest run",
|
|
106
115
|
"test:vue": "vue-demi-switch 3 && vitest run --dir ./src/vue",
|
|
107
116
|
"test:vue-2": "vue-demi-switch 2 vue-2 && vitest run --dir ./src/vue",
|
|
108
117
|
"test:vue-2.7": "vue-demi-switch 2.7 vue-2.7 && vitest run --dir ./src/vue",
|
|
109
118
|
"dev:test": "vitest",
|
|
110
|
-
"
|
|
119
|
+
"dev:test-vue": "vue-demi-switch 3 vue && vitest --dir ./src/vue",
|
|
120
|
+
"dev:test-vue-2": "vue-demi-switch 2 vue-2 && vitest --dir ./src/vue",
|
|
121
|
+
"dev:test-vue-2.7": "vue-demi-switch 2.7 vue-2.7 && vitest --dir ./src/vue",
|
|
122
|
+
"release": "release-it",
|
|
111
123
|
"lint": "eslint . --cache --cache-location ./node_modules/.cache/eslint",
|
|
112
124
|
"posttest:vue-2": "vue-demi-switch 3",
|
|
113
|
-
"posttest:vue-2.7": "vue-demi-switch 3"
|
|
125
|
+
"posttest:vue-2.7": "vue-demi-switch 3",
|
|
126
|
+
"postdev:test-vue-2": "vue-demi-switch 3",
|
|
127
|
+
"postdev:test-vue-2.7": "vue-demi-switch 3"
|
|
114
128
|
}
|
|
115
129
|
}
|
package/react.d.ts
CHANGED
package/vue.d.ts
CHANGED