@elementor/query 3.32.0-38 → 3.32.0-39
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/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +14 -1
- package/dist/index.mjs +13 -1
- package/package.json +1 -1
- package/src/index.ts +17 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QueryClient } from '@tanstack/react-query';
|
|
2
2
|
export { QueryClient, QueryClientProvider, UseQueryResult, useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
3
3
|
|
|
4
|
+
declare function getQueryClient(): QueryClient;
|
|
4
5
|
declare function createQueryClient(): QueryClient;
|
|
5
6
|
|
|
6
|
-
export { createQueryClient };
|
|
7
|
+
export { createQueryClient, getQueryClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QueryClient } from '@tanstack/react-query';
|
|
2
2
|
export { QueryClient, QueryClientProvider, UseQueryResult, useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
3
3
|
|
|
4
|
+
declare function getQueryClient(): QueryClient;
|
|
4
5
|
declare function createQueryClient(): QueryClient;
|
|
5
6
|
|
|
6
|
-
export { createQueryClient };
|
|
7
|
+
export { createQueryClient, getQueryClient };
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(index_exports, {
|
|
|
23
23
|
QueryClient: () => import_react_query2.QueryClient,
|
|
24
24
|
QueryClientProvider: () => import_react_query2.QueryClientProvider,
|
|
25
25
|
createQueryClient: () => createQueryClient,
|
|
26
|
+
getQueryClient: () => getQueryClient,
|
|
26
27
|
useInfiniteQuery: () => import_react_query2.useInfiniteQuery,
|
|
27
28
|
useMutation: () => import_react_query2.useMutation,
|
|
28
29
|
useQuery: () => import_react_query2.useQuery,
|
|
@@ -31,8 +32,18 @@ __export(index_exports, {
|
|
|
31
32
|
module.exports = __toCommonJS(index_exports);
|
|
32
33
|
var import_react_query = require("@tanstack/react-query");
|
|
33
34
|
var import_react_query2 = require("@tanstack/react-query");
|
|
35
|
+
var queryClient;
|
|
36
|
+
function getQueryClient() {
|
|
37
|
+
if (!queryClient) {
|
|
38
|
+
throw new Error("Query client is not created yet.");
|
|
39
|
+
}
|
|
40
|
+
return queryClient;
|
|
41
|
+
}
|
|
34
42
|
function createQueryClient() {
|
|
35
|
-
|
|
43
|
+
if (queryClient) {
|
|
44
|
+
throw new Error("Query client is already created.");
|
|
45
|
+
}
|
|
46
|
+
queryClient = new import_react_query.QueryClient({
|
|
36
47
|
defaultOptions: {
|
|
37
48
|
queries: {
|
|
38
49
|
refetchOnWindowFocus: false,
|
|
@@ -40,12 +51,14 @@ function createQueryClient() {
|
|
|
40
51
|
}
|
|
41
52
|
}
|
|
42
53
|
});
|
|
54
|
+
return queryClient;
|
|
43
55
|
}
|
|
44
56
|
// Annotate the CommonJS export names for ESM import in node:
|
|
45
57
|
0 && (module.exports = {
|
|
46
58
|
QueryClient,
|
|
47
59
|
QueryClientProvider,
|
|
48
60
|
createQueryClient,
|
|
61
|
+
getQueryClient,
|
|
49
62
|
useInfiniteQuery,
|
|
50
63
|
useMutation,
|
|
51
64
|
useQuery,
|
package/dist/index.mjs
CHANGED
|
@@ -8,8 +8,18 @@ import {
|
|
|
8
8
|
QueryClient as QueryClient2,
|
|
9
9
|
QueryClientProvider
|
|
10
10
|
} from "@tanstack/react-query";
|
|
11
|
+
var queryClient;
|
|
12
|
+
function getQueryClient() {
|
|
13
|
+
if (!queryClient) {
|
|
14
|
+
throw new Error("Query client is not created yet.");
|
|
15
|
+
}
|
|
16
|
+
return queryClient;
|
|
17
|
+
}
|
|
11
18
|
function createQueryClient() {
|
|
12
|
-
|
|
19
|
+
if (queryClient) {
|
|
20
|
+
throw new Error("Query client is already created.");
|
|
21
|
+
}
|
|
22
|
+
queryClient = new QueryClient({
|
|
13
23
|
defaultOptions: {
|
|
14
24
|
queries: {
|
|
15
25
|
refetchOnWindowFocus: false,
|
|
@@ -17,11 +27,13 @@ function createQueryClient() {
|
|
|
17
27
|
}
|
|
18
28
|
}
|
|
19
29
|
});
|
|
30
|
+
return queryClient;
|
|
20
31
|
}
|
|
21
32
|
export {
|
|
22
33
|
QueryClient2 as QueryClient,
|
|
23
34
|
QueryClientProvider,
|
|
24
35
|
createQueryClient,
|
|
36
|
+
getQueryClient,
|
|
25
37
|
useInfiniteQuery,
|
|
26
38
|
useMutation,
|
|
27
39
|
useQuery,
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -10,8 +10,22 @@ export {
|
|
|
10
10
|
type UseQueryResult,
|
|
11
11
|
} from '@tanstack/react-query';
|
|
12
12
|
|
|
13
|
+
let queryClient: QueryClient | undefined;
|
|
14
|
+
|
|
15
|
+
export function getQueryClient(): QueryClient {
|
|
16
|
+
if ( ! queryClient ) {
|
|
17
|
+
throw new Error( 'Query client is not created yet.' );
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return queryClient;
|
|
21
|
+
}
|
|
22
|
+
|
|
13
23
|
export function createQueryClient() {
|
|
14
|
-
|
|
24
|
+
if ( queryClient ) {
|
|
25
|
+
throw new Error( 'Query client is already created.' );
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
queryClient = new QueryClient( {
|
|
15
29
|
defaultOptions: {
|
|
16
30
|
queries: {
|
|
17
31
|
refetchOnWindowFocus: false,
|
|
@@ -19,4 +33,6 @@ export function createQueryClient() {
|
|
|
19
33
|
},
|
|
20
34
|
},
|
|
21
35
|
} );
|
|
36
|
+
|
|
37
|
+
return queryClient;
|
|
22
38
|
}
|