@contentful/field-editor-shared 2.17.1-alpha.0 → 2.17.1
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/cjs/queryClient.js
CHANGED
|
@@ -61,12 +61,12 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
61
61
|
}
|
|
62
62
|
return newObj;
|
|
63
63
|
}
|
|
64
|
-
let
|
|
64
|
+
let RQQueryClient;
|
|
65
65
|
let useRQ;
|
|
66
66
|
let useHostQueryClient = ()=>undefined;
|
|
67
67
|
try {
|
|
68
68
|
const rq = require('@tanstack/react-query');
|
|
69
|
-
|
|
69
|
+
RQQueryClient = rq.QueryClient;
|
|
70
70
|
useRQ = rq.useQuery;
|
|
71
71
|
useHostQueryClient = rq.useQueryClient;
|
|
72
72
|
} catch {}
|
|
@@ -86,7 +86,10 @@ function useQueryClient() {
|
|
|
86
86
|
return client;
|
|
87
87
|
}
|
|
88
88
|
if (hostClient) return hostClient;
|
|
89
|
-
|
|
89
|
+
if (!RQQueryClient) {
|
|
90
|
+
throw new Error('@tanstack/react-query is required to use QueryClient. Please install it as a dependency: npm install @tanstack/react-query');
|
|
91
|
+
}
|
|
92
|
+
return new RQQueryClient({
|
|
90
93
|
defaultOptions: {
|
|
91
94
|
queries: {
|
|
92
95
|
useErrorBoundary: false,
|
|
@@ -104,6 +107,9 @@ function useQueryClient() {
|
|
|
104
107
|
]);
|
|
105
108
|
}
|
|
106
109
|
function useQuery(queryKey, queryFn, options) {
|
|
110
|
+
if (!useRQ) {
|
|
111
|
+
throw new Error('@tanstack/react-query is required to use useQuery. Please install it as a dependency: npm install @tanstack/react-query');
|
|
112
|
+
}
|
|
107
113
|
return useRQ(queryKey, queryFn, {
|
|
108
114
|
...options,
|
|
109
115
|
context: clientContext
|
package/dist/esm/queryClient.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
let
|
|
2
|
+
let RQQueryClient;
|
|
3
3
|
let useRQ;
|
|
4
4
|
let useHostQueryClient = ()=>undefined;
|
|
5
5
|
try {
|
|
6
6
|
const rq = require('@tanstack/react-query');
|
|
7
|
-
|
|
7
|
+
RQQueryClient = rq.QueryClient;
|
|
8
8
|
useRQ = rq.useQuery;
|
|
9
9
|
useHostQueryClient = rq.useQueryClient;
|
|
10
10
|
} catch {}
|
|
@@ -24,7 +24,10 @@ export function useQueryClient() {
|
|
|
24
24
|
return client;
|
|
25
25
|
}
|
|
26
26
|
if (hostClient) return hostClient;
|
|
27
|
-
|
|
27
|
+
if (!RQQueryClient) {
|
|
28
|
+
throw new Error('@tanstack/react-query is required to use QueryClient. Please install it as a dependency: npm install @tanstack/react-query');
|
|
29
|
+
}
|
|
30
|
+
return new RQQueryClient({
|
|
28
31
|
defaultOptions: {
|
|
29
32
|
queries: {
|
|
30
33
|
useErrorBoundary: false,
|
|
@@ -42,6 +45,9 @@ export function useQueryClient() {
|
|
|
42
45
|
]);
|
|
43
46
|
}
|
|
44
47
|
export function useQuery(queryKey, queryFn, options) {
|
|
48
|
+
if (!useRQ) {
|
|
49
|
+
throw new Error('@tanstack/react-query is required to use useQuery. Please install it as a dependency: npm install @tanstack/react-query');
|
|
50
|
+
}
|
|
45
51
|
return useRQ(queryKey, queryFn, {
|
|
46
52
|
...options,
|
|
47
53
|
context: clientContext
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { QueryClient
|
|
3
|
-
export declare function useQueryClient():
|
|
2
|
+
import type { QueryClient, UseQueryOptions, UseQueryResult, QueryKey, QueryFunction } from '@tanstack/react-query';
|
|
3
|
+
export declare function useQueryClient(): QueryClient;
|
|
4
4
|
export declare function useQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(queryKey: TQueryKey, queryFn: QueryFunction<TQueryFnData, TQueryKey>, options?: Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryKey' | 'queryFn'>): UseQueryResult<TData, TError>;
|
|
5
5
|
/**
|
|
6
6
|
* Provides access to a query client either by sharing an existing client or
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-shared",
|
|
3
|
-
"version": "2.17.1
|
|
3
|
+
"version": "2.17.1",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"registry": "https://npm.pkg.github.com/"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "c8fbf95fbb880df05fd011b8892523c135c2a5fd"
|
|
71
71
|
}
|