@apollo/client 3.12.6 → 3.12.7
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/CHANGELOG.md +16 -0
- package/apollo-client.cjs +17 -13
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/index.d.ts +1 -1
- package/cache/index.js +0 -1
- package/cache/index.js.map +1 -1
- package/core/core.cjs +1 -1
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +1 -1
- package/core/index.d.ts +2 -2
- package/core/index.js +0 -2
- package/core/index.js.map +1 -1
- package/dev/dev.cjs +1 -1
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +1 -1
- package/errors/index.js.map +1 -1
- package/link/core/index.d.ts +1 -1
- package/link/core/index.js +0 -1
- package/link/core/index.js.map +1 -1
- package/link/core/types.d.ts +2 -2
- package/link/core/types.js.map +1 -1
- package/link/error/error.cjs +17 -8
- package/link/error/error.cjs.map +1 -1
- package/link/error/error.cjs.native.js +17 -8
- package/link/error/index.d.ts +17 -1
- package/link/error/index.js +17 -8
- package/link/error/index.js.map +1 -1
- package/link/persisted-queries/index.d.ts +2 -2
- package/package.json +28 -23
- package/react/components/index.d.ts +1 -1
- package/react/components/index.js +0 -1
- package/react/components/index.js.map +1 -1
- package/react/hoc/index.d.ts +1 -1
- package/react/hoc/index.js +0 -1
- package/react/hoc/index.js.map +1 -1
- package/react/hooks/hooks.cjs +16 -12
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +16 -12
- package/react/hooks/internal/useDeepMemo.js +1 -0
- package/react/hooks/internal/useDeepMemo.js.map +1 -1
- package/react/hooks/useBackgroundQuery.js +4 -2
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.js +4 -2
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useMutation.js +1 -0
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.js +5 -2
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.js +2 -2
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useReadQuery.js +2 -2
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.js +1 -0
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +5 -2
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/index.d.ts +1 -1
- package/react/index.js +0 -1
- package/react/index.js.map +1 -1
- package/react/internal/internal.cjs +1 -1
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +1 -1
- package/testing/internal/incremental.d.ts +23 -0
- package/testing/internal/incremental.js +124 -0
- package/testing/internal/incremental.js.map +1 -0
- package/testing/internal/index.d.ts +1 -0
- package/testing/internal/index.js +1 -0
- package/testing/internal/index.js.map +1 -1
- package/testing/internal/scenarios/index.d.ts +1 -0
- package/testing/internal/scenarios/index.js.map +1 -1
- package/testing/matchers/index.js +4 -0
- package/testing/matchers/index.js.map +1 -1
- package/testing/matchers/toEqualApolloQueryResult.d.ts +6 -0
- package/testing/matchers/toEqualApolloQueryResult.js +20 -0
- package/testing/matchers/toEqualApolloQueryResult.js.map +1 -0
- package/testing/matchers/toEqualQueryResult.d.ts +9 -0
- package/testing/matchers/toEqualQueryResult.js +40 -0
- package/testing/matchers/toEqualQueryResult.js.map +1 -0
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/utilities/index.d.ts +1 -1
- package/utilities/index.js +0 -1
- package/utilities/index.js.map +1 -1
- package/version.js +1 -1
package/link/error/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __extends } from "tslib";
|
|
2
|
+
import { graphQLResultHasProtocolErrors, PROTOCOL_ERRORS_SYMBOL, } from "../../errors/index.js";
|
|
2
3
|
import { Observable } from "../../utilities/index.js";
|
|
3
4
|
import { ApolloLink } from "../core/index.js";
|
|
4
5
|
export function onError(errorHandler) {
|
|
@@ -17,14 +18,22 @@ export function onError(errorHandler) {
|
|
|
17
18
|
operation: operation,
|
|
18
19
|
forward: forward,
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
21
|
+
}
|
|
22
|
+
else if (graphQLResultHasProtocolErrors(result)) {
|
|
23
|
+
retriedResult = errorHandler({
|
|
24
|
+
protocolErrors: result.extensions[PROTOCOL_ERRORS_SYMBOL],
|
|
25
|
+
response: result,
|
|
26
|
+
operation: operation,
|
|
27
|
+
forward: forward,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (retriedResult) {
|
|
31
|
+
retriedSub = retriedResult.subscribe({
|
|
32
|
+
next: observer.next.bind(observer),
|
|
33
|
+
error: observer.error.bind(observer),
|
|
34
|
+
complete: observer.complete.bind(observer),
|
|
35
|
+
});
|
|
36
|
+
return;
|
|
28
37
|
}
|
|
29
38
|
observer.next(result);
|
|
30
39
|
},
|
package/link/error/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/error/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/error/index.ts"],"names":[],"mappings":";AAMA,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAsC9C,MAAM,UAAU,OAAO,CAAC,YAA0B;IAChD,OAAO,IAAI,UAAU,CAAC,UAAC,SAAS,EAAE,OAAO;QACvC,OAAO,IAAI,UAAU,CAAC,UAAC,QAAQ;YAC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,OAAiB;QAEjB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IACH,gBAAC;AAAD,CAAC,AAbD,CAA+B,UAAU,GAaxC","sourcesContent":["import type {\n FormattedExecutionResult,\n GraphQLErrorExtensions,\n GraphQLFormattedError,\n} from \"graphql\";\n\nimport {\n graphQLResultHasProtocolErrors,\n PROTOCOL_ERRORS_SYMBOL,\n} from \"../../errors/index.js\";\nimport type { NetworkError } from \"../../errors/index.js\";\nimport { Observable } from \"../../utilities/index.js\";\nimport type { Operation, FetchResult, NextLink } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\n\nexport interface ErrorResponse {\n /**\n * Errors returned in the `errors` property of the GraphQL response.\n */\n graphQLErrors?: ReadonlyArray<GraphQLFormattedError>;\n /**\n * Errors thrown during a network request. This is usually an error thrown\n * during a `fetch` call or an error while parsing the response from the\n * network.\n */\n networkError?: NetworkError;\n /**\n * Fatal transport-level errors from multipart subscriptions.\n * See the [multipart subscription protocol](https://www.apollographql.com/docs/graphos/routing/operations/subscriptions/multipart-protocol#message-and-error-format) for more information.\n */\n protocolErrors?: ReadonlyArray<{\n message: string;\n extensions?: GraphQLErrorExtensions[];\n }>;\n response?: FormattedExecutionResult;\n operation: Operation;\n forward: NextLink;\n}\n\nexport namespace ErrorLink {\n /**\n * Callback to be triggered when an error occurs within the link stack.\n */\n export interface ErrorHandler {\n (error: ErrorResponse): Observable<FetchResult> | void;\n }\n}\n\n// For backwards compatibility.\nexport import ErrorHandler = ErrorLink.ErrorHandler;\n\nexport function onError(errorHandler: ErrorHandler): ApolloLink {\n return new ApolloLink((operation, forward) => {\n return new Observable((observer) => {\n let sub: any;\n let retriedSub: any;\n let retriedResult: any;\n\n try {\n sub = forward(operation).subscribe({\n next: (result) => {\n if (result.errors) {\n retriedResult = errorHandler({\n graphQLErrors: result.errors,\n response: result,\n operation,\n forward,\n });\n } else if (graphQLResultHasProtocolErrors(result)) {\n retriedResult = errorHandler({\n protocolErrors: result.extensions[PROTOCOL_ERRORS_SYMBOL],\n response: result,\n operation,\n forward,\n });\n }\n\n if (retriedResult) {\n retriedSub = retriedResult.subscribe({\n next: observer.next.bind(observer),\n error: observer.error.bind(observer),\n complete: observer.complete.bind(observer),\n });\n return;\n }\n\n observer.next(result);\n },\n error: (networkError) => {\n retriedResult = errorHandler({\n operation,\n networkError,\n //Network errors can return GraphQL errors on for example a 403\n graphQLErrors:\n (networkError &&\n networkError.result &&\n networkError.result.errors) ||\n void 0,\n forward,\n });\n if (retriedResult) {\n retriedSub = retriedResult.subscribe({\n next: observer.next.bind(observer),\n error: observer.error.bind(observer),\n complete: observer.complete.bind(observer),\n });\n return;\n }\n observer.error(networkError);\n },\n complete: () => {\n // disable the previous sub from calling complete on observable\n // if retry is in flight.\n if (!retriedResult) {\n observer.complete.bind(observer)();\n }\n },\n });\n } catch (e) {\n errorHandler({ networkError: e as Error, operation, forward });\n observer.error(e);\n }\n\n return () => {\n if (sub) sub.unsubscribe();\n if (retriedSub) sub.unsubscribe();\n };\n });\n });\n}\n\nexport class ErrorLink extends ApolloLink {\n private link: ApolloLink;\n constructor(errorHandler: ErrorLink.ErrorHandler) {\n super();\n this.link = onError(errorHandler);\n }\n\n public request(\n operation: Operation,\n forward: NextLink\n ): Observable<FetchResult> | null {\n return this.link.request(operation, forward);\n }\n}\n"]}
|
|
@@ -33,7 +33,7 @@ export declare namespace PersistedQueryLink {
|
|
|
33
33
|
export type Options = SHA256Options | GenerateHashOptions;
|
|
34
34
|
export {};
|
|
35
35
|
}
|
|
36
|
-
export declare const createPersistedQueryLink: (options: PersistedQueryLink.Options) => ApolloLink & {
|
|
36
|
+
export declare const createPersistedQueryLink: (options: PersistedQueryLink.Options) => ApolloLink & ({
|
|
37
37
|
resetHashCache: () => void;
|
|
38
38
|
} & ({
|
|
39
39
|
getMemoryInternals(): {
|
|
@@ -43,6 +43,6 @@ export declare const createPersistedQueryLink: (options: PersistedQueryLink.Opti
|
|
|
43
43
|
};
|
|
44
44
|
} | {
|
|
45
45
|
getMemoryInternals?: undefined;
|
|
46
|
-
});
|
|
46
|
+
}));
|
|
47
47
|
export {};
|
|
48
48
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apollo/client",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.7",
|
|
4
4
|
"description": "A fully-featured caching GraphQL client.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"keywords": [
|
|
@@ -68,20 +68,23 @@
|
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@arethetypeswrong/cli": "0.15.3",
|
|
71
|
-
"@ark/attest": "
|
|
71
|
+
"@ark/attest": "0.28.0",
|
|
72
72
|
"@babel/parser": "7.25.0",
|
|
73
73
|
"@changesets/changelog-github": "0.5.0",
|
|
74
74
|
"@changesets/cli": "2.27.7",
|
|
75
|
+
"@eslint/compat": "1.2.5",
|
|
76
|
+
"@eslint/eslintrc": "3.2.0",
|
|
77
|
+
"@eslint/js": "9.18.0",
|
|
75
78
|
"@graphql-tools/merge": "9.0.4",
|
|
76
79
|
"@graphql-tools/schema": "10.0.4",
|
|
77
80
|
"@graphql-tools/utils": "10.5.0",
|
|
78
|
-
"@microsoft/api-extractor": "7.
|
|
81
|
+
"@microsoft/api-extractor": "7.49.1",
|
|
79
82
|
"@rollup/plugin-node-resolve": "11.2.1",
|
|
80
83
|
"@size-limit/esbuild-why": "11.1.4",
|
|
81
84
|
"@size-limit/preset-small-lib": "11.1.4",
|
|
82
|
-
"@testing-library/dom": "
|
|
85
|
+
"@testing-library/dom": "10.4.0",
|
|
83
86
|
"@testing-library/jest-dom": "6.6.3",
|
|
84
|
-
"@testing-library/react": "
|
|
87
|
+
"@testing-library/react": "16.1.0",
|
|
85
88
|
"@testing-library/react-render-stream": "2.0.0",
|
|
86
89
|
"@testing-library/user-event": "14.5.2",
|
|
87
90
|
"@tsconfig/node20": "20.1.4",
|
|
@@ -91,34 +94,36 @@
|
|
|
91
94
|
"@types/hoist-non-react-statics": "3.3.5",
|
|
92
95
|
"@types/jest": "29.5.12",
|
|
93
96
|
"@types/lodash": "4.17.7",
|
|
94
|
-
"@types/node": "
|
|
97
|
+
"@types/node": "22.10.7",
|
|
95
98
|
"@types/node-fetch": "2.6.11",
|
|
96
|
-
"@types/prop-types": "
|
|
99
|
+
"@types/prop-types": "15.7.14",
|
|
97
100
|
"@types/react": "19.0.0",
|
|
98
101
|
"@types/react-dom": "19.0.0",
|
|
99
102
|
"@types/relay-runtime": "14.1.24",
|
|
100
103
|
"@types/use-sync-external-store": "0.0.6",
|
|
101
|
-
"@typescript-eslint/eslint-plugin": "
|
|
102
|
-
"@typescript-eslint/parser": "
|
|
103
|
-
"@typescript-eslint/rule-tester": "
|
|
104
|
-
"@typescript-eslint/types": "
|
|
105
|
-
"@typescript-eslint/utils": "
|
|
104
|
+
"@typescript-eslint/eslint-plugin": "8.21.0",
|
|
105
|
+
"@typescript-eslint/parser": "8.21.0",
|
|
106
|
+
"@typescript-eslint/rule-tester": "8.21.0",
|
|
107
|
+
"@typescript-eslint/types": "8.21.0",
|
|
108
|
+
"@typescript-eslint/utils": "8.21.0",
|
|
106
109
|
"acorn": "8.12.1",
|
|
107
110
|
"ajv": "8.17.1",
|
|
108
111
|
"blob-polyfill": "7.0.20220408",
|
|
109
112
|
"bytes": "3.1.2",
|
|
110
113
|
"cross-fetch": "4.0.0",
|
|
111
|
-
"eslint": "
|
|
112
|
-
"eslint-import-resolver-typescript": "3.
|
|
114
|
+
"eslint": "9.18.0",
|
|
115
|
+
"eslint-import-resolver-typescript": "3.7.0",
|
|
113
116
|
"eslint-plugin-import": "npm:@phryneas/eslint-plugin-import@2.27.5-pr.2813.2817.199971c",
|
|
114
|
-
"eslint-plugin-local-rules": "
|
|
115
|
-
"eslint-plugin-react-compiler": "
|
|
116
|
-
"eslint-plugin-react-hooks": "
|
|
117
|
-
"eslint-plugin-testing-library": "
|
|
118
|
-
"expect-type": "
|
|
117
|
+
"eslint-plugin-local-rules": "3.0.2",
|
|
118
|
+
"eslint-plugin-react-compiler": "19.0.0-beta-decd7b8-20250118",
|
|
119
|
+
"eslint-plugin-react-hooks": "5.1.0",
|
|
120
|
+
"eslint-plugin-testing-library": "7.1.1",
|
|
121
|
+
"expect-type": "1.1.0",
|
|
119
122
|
"fetch-mock": "9.11.0",
|
|
120
123
|
"glob": "8.1.0",
|
|
124
|
+
"globals": "15.14.0",
|
|
121
125
|
"graphql": "16.9.0",
|
|
126
|
+
"graphql-17-alpha2": "npm:graphql@17.0.0-alpha.2",
|
|
122
127
|
"graphql-ws": "5.16.0",
|
|
123
128
|
"jest": "29.7.0",
|
|
124
129
|
"jest-environment-jsdom": "29.7.0",
|
|
@@ -144,14 +149,14 @@
|
|
|
144
149
|
"size-limit": "11.1.4",
|
|
145
150
|
"subscriptions-transport-ws": "0.11.0",
|
|
146
151
|
"terser": "5.31.3",
|
|
147
|
-
"ts-api-utils": "
|
|
152
|
+
"ts-api-utils": "2.0.0",
|
|
148
153
|
"ts-jest": "29.2.3",
|
|
149
154
|
"ts-jest-resolver": "2.0.1",
|
|
150
|
-
"ts-morph": "
|
|
155
|
+
"ts-morph": "25.0.0",
|
|
151
156
|
"ts-node": "10.9.2",
|
|
152
|
-
"tsx": "
|
|
157
|
+
"tsx": "4.19.2",
|
|
153
158
|
"typedoc": "0.25.0",
|
|
154
|
-
"typescript": "5.
|
|
159
|
+
"typescript": "5.7.3",
|
|
155
160
|
"wait-for-observables": "1.0.3",
|
|
156
161
|
"web-streams-polyfill": "4.0.0",
|
|
157
162
|
"whatwg-fetch": "3.6.20"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { Query } from \"./Query.js\";\nexport { Mutation } from \"./Mutation.js\";\nexport { Subscription } from \"./Subscription.js\";\n\nexport type * from \"./types.js\";\n"]}
|
package/react/hoc/index.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export { withQuery } from "./query-hoc.js";
|
|
|
4
4
|
export { withMutation } from "./mutation-hoc.js";
|
|
5
5
|
export { withSubscription } from "./subscription-hoc.js";
|
|
6
6
|
export { withApollo } from "./withApollo.js";
|
|
7
|
-
export * from "./types.js";
|
|
7
|
+
export type * from "./types.js";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/react/hoc/index.js
CHANGED
package/react/hoc/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/hoc/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/hoc/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["import \"../../utilities/globals/index.js\";\n\nexport { graphql } from \"./graphql.js\";\n\nexport { withQuery } from \"./query-hoc.js\";\nexport { withMutation } from \"./mutation-hoc.js\";\nexport { withSubscription } from \"./subscription-hoc.js\";\nexport { withApollo } from \"./withApollo.js\";\n\nexport type * from \"./types.js\";\n"]}
|
package/react/hooks/hooks.cjs
CHANGED
|
@@ -148,9 +148,10 @@ function noop() { }
|
|
|
148
148
|
var lastWatchOptions = Symbol();
|
|
149
149
|
function useQuery(query, options) {
|
|
150
150
|
if (options === void 0) { options = Object.create(null); }
|
|
151
|
-
return wrapHook("useQuery",
|
|
151
|
+
return wrapHook("useQuery",
|
|
152
|
+
useQuery_, useApolloClient(options && options.client))(query, options);
|
|
152
153
|
}
|
|
153
|
-
function
|
|
154
|
+
function useQuery_(query, options) {
|
|
154
155
|
var _a = useQueryInternals(query, options), result = _a.result, obsQueryFields = _a.obsQueryFields;
|
|
155
156
|
return React__namespace.useMemo(function () { return (tslib.__assign(tslib.__assign({}, result), obsQueryFields)); }, [result, obsQueryFields]);
|
|
156
157
|
}
|
|
@@ -821,9 +822,10 @@ function useReactiveVar(rv) {
|
|
|
821
822
|
}
|
|
822
823
|
|
|
823
824
|
function useFragment(options) {
|
|
824
|
-
return wrapHook("useFragment",
|
|
825
|
+
return wrapHook("useFragment",
|
|
826
|
+
useFragment_, useApolloClient(options.client))(options);
|
|
825
827
|
}
|
|
826
|
-
function
|
|
828
|
+
function useFragment_(options) {
|
|
827
829
|
var client = useApolloClient(options.client);
|
|
828
830
|
var cache = client.cache;
|
|
829
831
|
var from = options.from, rest = tslib.__rest(options, ["from"]);
|
|
@@ -888,9 +890,10 @@ var skipToken = Symbol.for("apollo.skipToken");
|
|
|
888
890
|
|
|
889
891
|
function useSuspenseQuery(query, options) {
|
|
890
892
|
if (options === void 0) { options = Object.create(null); }
|
|
891
|
-
return wrapHook("useSuspenseQuery",
|
|
893
|
+
return wrapHook("useSuspenseQuery",
|
|
894
|
+
useSuspenseQuery_, useApolloClient(typeof options === "object" ? options.client : undefined))(query, options);
|
|
892
895
|
}
|
|
893
|
-
function
|
|
896
|
+
function useSuspenseQuery_(query, options) {
|
|
894
897
|
var client = useApolloClient(options.client);
|
|
895
898
|
var suspenseCache = internal.getSuspenseCache(client);
|
|
896
899
|
var watchQueryOptions = useWatchQueryOptions({
|
|
@@ -1008,9 +1011,10 @@ function useWatchQueryOptions(_a) {
|
|
|
1008
1011
|
|
|
1009
1012
|
function useBackgroundQuery(query, options) {
|
|
1010
1013
|
if (options === void 0) { options = Object.create(null); }
|
|
1011
|
-
return wrapHook("useBackgroundQuery",
|
|
1014
|
+
return wrapHook("useBackgroundQuery",
|
|
1015
|
+
useBackgroundQuery_, useApolloClient(typeof options === "object" ? options.client : undefined))(query, options);
|
|
1012
1016
|
}
|
|
1013
|
-
function
|
|
1017
|
+
function useBackgroundQuery_(query, options) {
|
|
1014
1018
|
var client = useApolloClient(options.client);
|
|
1015
1019
|
var suspenseCache = internal.getSuspenseCache(client);
|
|
1016
1020
|
var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options });
|
|
@@ -1127,11 +1131,11 @@ function useLoadableQuery(query, options) {
|
|
|
1127
1131
|
|
|
1128
1132
|
function useQueryRefHandlers(queryRef) {
|
|
1129
1133
|
var unwrapped = internal.unwrapQueryRef(queryRef);
|
|
1130
|
-
return wrapHook("useQueryRefHandlers",
|
|
1134
|
+
return wrapHook("useQueryRefHandlers", useQueryRefHandlers_, unwrapped ?
|
|
1131
1135
|
unwrapped["observable"]
|
|
1132
1136
|
: useApolloClient())(queryRef);
|
|
1133
1137
|
}
|
|
1134
|
-
function
|
|
1138
|
+
function useQueryRefHandlers_(queryRef) {
|
|
1135
1139
|
internal.assertWrappedQueryRef(queryRef);
|
|
1136
1140
|
var _a = React__namespace.useState(queryRef), previousQueryRef = _a[0], setPreviousQueryRef = _a[1];
|
|
1137
1141
|
var _b = React__namespace.useState(queryRef), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1];
|
|
@@ -1162,11 +1166,11 @@ function _useQueryRefHandlers(queryRef) {
|
|
|
1162
1166
|
|
|
1163
1167
|
function useReadQuery(queryRef) {
|
|
1164
1168
|
var unwrapped = internal.unwrapQueryRef(queryRef);
|
|
1165
|
-
return wrapHook("useReadQuery",
|
|
1169
|
+
return wrapHook("useReadQuery", useReadQuery_, unwrapped ?
|
|
1166
1170
|
unwrapped["observable"]
|
|
1167
1171
|
: useApolloClient())(queryRef);
|
|
1168
1172
|
}
|
|
1169
|
-
function
|
|
1173
|
+
function useReadQuery_(queryRef) {
|
|
1170
1174
|
internal.assertWrappedQueryRef(queryRef);
|
|
1171
1175
|
var internalQueryRef = React__namespace.useMemo(function () { return internal.unwrapQueryRef(queryRef); }, [queryRef]);
|
|
1172
1176
|
var getPromise = React__namespace.useCallback(function () { return internal.getWrappedPromise(queryRef); }, [queryRef]);
|