@apollo/client 3.11.4 → 3.11.6
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 +19 -29
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/core.cjs +1 -1
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +1 -1
- package/dev/dev.cjs +1 -1
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +1 -1
- package/package.json +4 -4
- package/react/hooks/hooks.cjs +18 -28
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +18 -28
- package/react/hooks/internal/index.d.ts +0 -1
- package/react/hooks/internal/index.js +0 -1
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/useFragment.js +22 -16
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +1 -1
- package/react/hooks/useSubscription.js +5 -4
- package/react/hooks/useSubscription.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/react/types/types.d.ts +1 -1
- package/react/types/types.js.map +1 -1
- package/utilities/caching/sizes.d.ts +2 -2
- package/utilities/caching/sizes.js.map +1 -1
- 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/version.js +1 -1
- package/react/hooks/internal/useLazyRef.d.ts +0 -3
- package/react/hooks/internal/useLazyRef.js +0 -10
- package/react/hooks/internal/useLazyRef.js.map +0 -1
|
@@ -120,15 +120,6 @@ function useRenderGuard() {
|
|
|
120
120
|
}, []);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
var INIT = {};
|
|
124
|
-
function useLazyRef(getInitialValue) {
|
|
125
|
-
var ref = React__namespace.useRef(INIT);
|
|
126
|
-
if (ref.current === INIT) {
|
|
127
|
-
ref.current = getInitialValue();
|
|
128
|
-
}
|
|
129
|
-
return ref;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
123
|
var useKey = "use";
|
|
133
124
|
var realHook = React__namespace[useKey];
|
|
134
125
|
var __use = realHook ||
|
|
@@ -784,10 +775,11 @@ function useSubscription(subscription, options) {
|
|
|
784
775
|
observable.__.result
|
|
785
776
|
: fallbackResult;
|
|
786
777
|
}, function () { return fallbackResult; });
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
778
|
+
var restart = React__namespace.useCallback(function () {
|
|
779
|
+
globals.invariant(!optionsRef.current.skip, 57);
|
|
780
|
+
setObservable(recreateRef.current());
|
|
781
|
+
}, [optionsRef, recreateRef]);
|
|
782
|
+
return React__namespace.useMemo(function () { return (tslib.__assign(tslib.__assign({}, ret), { restart: restart })); }, [ret, restart]);
|
|
791
783
|
}
|
|
792
784
|
function createSubscription(client, query, variables, fetchPolicy, errorPolicy, context, extensions) {
|
|
793
785
|
var options = {
|
|
@@ -832,25 +824,23 @@ function useFragment(options) {
|
|
|
832
824
|
}
|
|
833
825
|
function _useFragment(options) {
|
|
834
826
|
var cache = useApolloClient(options.client).cache;
|
|
835
|
-
var
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
return
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
}, [diffOptions, cache]);
|
|
846
|
-
var getSnapshot = React__namespace.useCallback(function () { return resultRef.current; }, []);
|
|
827
|
+
var from = options.from, rest = tslib.__rest(options, ["from"]);
|
|
828
|
+
var id = React__namespace.useMemo(function () { return (typeof from === "string" ? from : cache.identify(from)); }, [cache, from]);
|
|
829
|
+
var stableOptions = useDeepMemo(function () { return (tslib.__assign(tslib.__assign({}, rest), { from: id })); }, [rest, id]);
|
|
830
|
+
var diff = React__namespace.useMemo(function () {
|
|
831
|
+
var fragment = stableOptions.fragment, fragmentName = stableOptions.fragmentName, from = stableOptions.from, _a = stableOptions.optimistic, optimistic = _a === void 0 ? true : _a;
|
|
832
|
+
return {
|
|
833
|
+
result: diffToResult(cache.diff(tslib.__assign(tslib.__assign({}, stableOptions), { returnPartialData: true, id: from, query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic }))),
|
|
834
|
+
};
|
|
835
|
+
}, [stableOptions, cache]);
|
|
836
|
+
var getSnapshot = React__namespace.useCallback(function () { return diff.result; }, [diff]);
|
|
847
837
|
return useSyncExternalStore(React__namespace.useCallback(function (forceUpdate) {
|
|
848
838
|
var lastTimeout = 0;
|
|
849
839
|
var subscription = cache.watchFragment(stableOptions).subscribe({
|
|
850
840
|
next: function (result) {
|
|
851
|
-
if (equal__default(result,
|
|
841
|
+
if (equal__default(result, diff.result))
|
|
852
842
|
return;
|
|
853
|
-
|
|
843
|
+
diff.result = result;
|
|
854
844
|
clearTimeout(lastTimeout);
|
|
855
845
|
lastTimeout = setTimeout(forceUpdate);
|
|
856
846
|
},
|
|
@@ -859,7 +849,7 @@ function _useFragment(options) {
|
|
|
859
849
|
subscription.unsubscribe();
|
|
860
850
|
clearTimeout(lastTimeout);
|
|
861
851
|
};
|
|
862
|
-
}, [cache, stableOptions]), getSnapshot, getSnapshot);
|
|
852
|
+
}, [cache, stableOptions, diff]), getSnapshot, getSnapshot);
|
|
863
853
|
}
|
|
864
854
|
function diffToResult(diff) {
|
|
865
855
|
var result = {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { useDeepMemo } from "./useDeepMemo.js";
|
|
2
2
|
export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
|
|
3
3
|
export { useRenderGuard } from "./useRenderGuard.js";
|
|
4
|
-
export { useLazyRef } from "./useLazyRef.js";
|
|
5
4
|
export { __use } from "./__use.js";
|
|
6
5
|
export { wrapHook } from "./wrapHook.js";
|
|
7
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
export { useDeepMemo } from "./useDeepMemo.js";
|
|
3
3
|
export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
|
|
4
4
|
export { useRenderGuard } from "./useRenderGuard.js";
|
|
5
|
-
export { useLazyRef } from "./useLazyRef.js";
|
|
6
5
|
export { __use } from "./__use.js";
|
|
7
6
|
export { wrapHook } from "./wrapHook.js";
|
|
8
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC","sourcesContent":["// These hooks are used internally and are not exported publicly by the library\nexport { useDeepMemo } from \"./useDeepMemo.js\";\nexport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect.js\";\nexport { useRenderGuard } from \"./useRenderGuard.js\";\nexport { __use } from \"./__use.js\";\nexport { wrapHook } from \"./wrapHook.js\";\n"]}
|
|
@@ -3,35 +3,41 @@ import * as React from "rehackt";
|
|
|
3
3
|
import { mergeDeepArray } from "../../utilities/index.js";
|
|
4
4
|
import { useApolloClient } from "./useApolloClient.js";
|
|
5
5
|
import { useSyncExternalStore } from "./useSyncExternalStore.js";
|
|
6
|
-
import { useDeepMemo,
|
|
6
|
+
import { useDeepMemo, wrapHook } from "./internal/index.js";
|
|
7
7
|
import equal from "@wry/equality";
|
|
8
8
|
export function useFragment(options) {
|
|
9
9
|
return wrapHook("useFragment", _useFragment, useApolloClient(options.client))(options);
|
|
10
10
|
}
|
|
11
11
|
function _useFragment(options) {
|
|
12
12
|
var cache = useApolloClient(options.client).cache;
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
var stableOptions = useDeepMemo(function () { return options; }, [options]);
|
|
13
|
+
var from = options.from, rest = __rest(options, ["from"]);
|
|
14
|
+
// We calculate the cache id seperately from `stableOptions` because we don't
|
|
15
|
+
// want changes to non key fields in the `from` property to affect
|
|
16
|
+
// `stableOptions` and retrigger our subscription. If the cache identifier
|
|
17
|
+
// stays the same between renders, we want to reuse the existing subscription.
|
|
18
|
+
var id = React.useMemo(function () { return (typeof from === "string" ? from : cache.identify(from)); }, [cache, from]);
|
|
19
|
+
var stableOptions = useDeepMemo(function () { return (__assign(__assign({}, rest), { from: id })); }, [rest, id]);
|
|
21
20
|
// Since .next is async, we need to make sure that we
|
|
22
21
|
// get the correct diff on the next render given new diffOptions
|
|
23
|
-
React.useMemo(function () {
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
var diff = React.useMemo(function () {
|
|
23
|
+
var fragment = stableOptions.fragment, fragmentName = stableOptions.fragmentName, from = stableOptions.from, _a = stableOptions.optimistic, optimistic = _a === void 0 ? true : _a;
|
|
24
|
+
return {
|
|
25
|
+
result: diffToResult(cache.diff(__assign(__assign({}, stableOptions), { returnPartialData: true, id: from, query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic }))),
|
|
26
|
+
};
|
|
27
|
+
}, [stableOptions, cache]);
|
|
26
28
|
// Used for both getSnapshot and getServerSnapshot
|
|
27
|
-
var getSnapshot = React.useCallback(function () { return
|
|
29
|
+
var getSnapshot = React.useCallback(function () { return diff.result; }, [diff]);
|
|
28
30
|
return useSyncExternalStore(React.useCallback(function (forceUpdate) {
|
|
29
31
|
var lastTimeout = 0;
|
|
30
32
|
var subscription = cache.watchFragment(stableOptions).subscribe({
|
|
31
33
|
next: function (result) {
|
|
32
|
-
|
|
34
|
+
// Since `next` is called async by zen-observable, we want to avoid
|
|
35
|
+
// unnecessarily rerendering this hook for the initial result
|
|
36
|
+
// emitted from watchFragment which should be equal to
|
|
37
|
+
// `diff.result`.
|
|
38
|
+
if (equal(result, diff.result))
|
|
33
39
|
return;
|
|
34
|
-
|
|
40
|
+
diff.result = result;
|
|
35
41
|
// If we get another update before we've re-rendered, bail out of
|
|
36
42
|
// the update and try again. This ensures that the relative timing
|
|
37
43
|
// between useQuery and useFragment stays roughly the same as
|
|
@@ -44,7 +50,7 @@ function _useFragment(options) {
|
|
|
44
50
|
subscription.unsubscribe();
|
|
45
51
|
clearTimeout(lastTimeout);
|
|
46
52
|
};
|
|
47
|
-
}, [cache, stableOptions]), getSnapshot, getSnapshot);
|
|
53
|
+
}, [cache, stableOptions, diff]), getSnapshot, getSnapshot);
|
|
48
54
|
}
|
|
49
55
|
function diffToResult(diff) {
|
|
50
56
|
var result = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFragment.js","sourceRoot":"","sources":["../../../src/react/hooks/useFragment.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAQ1D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE,OAAO,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"useFragment.js","sourceRoot":"","sources":["../../../src/react/hooks/useFrag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,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,EACD,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,CAC7B,EACD,WAAW,EACX,WAAW,CACZ,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,IAA6B;IAE7B,IAAM,MAAM,GAAG;QACb,IAAI,EAAE,IAAI,CAAC,MAAO;QAClB,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ;KACE,CAAC;IAE9B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,CAAC,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,OAAO,EAAb,CAAa,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import * as React from \"rehackt\";\nimport type { DeepPartial } from \"../../utilities/index.js\";\nimport { mergeDeepArray } from \"../../utilities/index.js\";\nimport type {\n Cache,\n Reference,\n StoreObject,\n MissingTree,\n} from \"../../cache/index.js\";\n\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\nimport type { ApolloClient, OperationVariables } from \"../../core/index.js\";\nimport type { NoInfer } from \"../types/types.js\";\nimport { useDeepMemo, wrapHook } from \"./internal/index.js\";\nimport equal from \"@wry/equality\";\n\nexport interface UseFragmentOptions<TData, TVars>\n extends Omit<\n Cache.DiffOptions<NoInfer<TData>, NoInfer<TVars>>,\n \"id\" | \"query\" | \"optimistic\" | \"previousResult\" | \"returnPartialData\"\n >,\n Omit<\n Cache.ReadFragmentOptions<TData, TVars>,\n \"id\" | \"variables\" | \"returnPartialData\"\n > {\n from: StoreObject | Reference | string;\n // Override this field to make it optional (default: true).\n optimistic?: boolean;\n /**\n * The instance of `ApolloClient` to use to look up the fragment.\n *\n * By default, the instance that's passed down via context is used, but you\n * can provide a different instance here.\n *\n * @docGroup 1. Operation options\n */\n client?: ApolloClient<any>;\n}\n\nexport type UseFragmentResult<TData> =\n | {\n data: TData;\n complete: true;\n missing?: never;\n }\n | {\n data: DeepPartial<TData>;\n complete: false;\n missing?: MissingTree;\n };\n\nexport function useFragment<TData = any, TVars = OperationVariables>(\n options: UseFragmentOptions<TData, TVars>\n): UseFragmentResult<TData> {\n return wrapHook(\n \"useFragment\",\n _useFragment,\n useApolloClient(options.client)\n )(options);\n}\n\nfunction _useFragment<TData = any, TVars = OperationVariables>(\n options: UseFragmentOptions<TData, TVars>\n): UseFragmentResult<TData> {\n const { cache } = useApolloClient(options.client);\n const { from, ...rest } = options;\n\n // We calculate the cache id seperately from `stableOptions` because we don't\n // want changes to non key fields in the `from` property to affect\n // `stableOptions` and retrigger our subscription. If the cache identifier\n // stays the same between renders, we want to reuse the existing subscription.\n const id = React.useMemo(\n () => (typeof from === \"string\" ? from : cache.identify(from)),\n [cache, from]\n );\n\n const stableOptions = useDeepMemo(() => ({ ...rest, from: id! }), [rest, id]);\n\n // Since .next is async, we need to make sure that we\n // get the correct diff on the next render given new diffOptions\n const diff = React.useMemo(() => {\n const { fragment, fragmentName, from, optimistic = true } = stableOptions;\n\n return {\n result: diffToResult(\n cache.diff<TData>({\n ...stableOptions,\n returnPartialData: true,\n id: from,\n query: cache[\"getFragmentDoc\"](fragment, fragmentName),\n optimistic,\n })\n ),\n };\n }, [stableOptions, cache]);\n\n // Used for both getSnapshot and getServerSnapshot\n const getSnapshot = React.useCallback(() => diff.result, [diff]);\n\n return useSyncExternalStore(\n React.useCallback(\n (forceUpdate) => {\n let lastTimeout = 0;\n const subscription = cache.watchFragment(stableOptions).subscribe({\n next: (result) => {\n // Since `next` is called async by zen-observable, we want to avoid\n // unnecessarily rerendering this hook for the initial result\n // emitted from watchFragment which should be equal to\n // `diff.result`.\n if (equal(result, diff.result)) return;\n diff.result = result;\n // If we get another update before we've re-rendered, bail out of\n // the update and try again. This ensures that the relative timing\n // between useQuery and useFragment stays roughly the same as\n // fixed in https://github.com/apollographql/apollo-client/pull/11083\n clearTimeout(lastTimeout);\n lastTimeout = setTimeout(forceUpdate) as any;\n },\n });\n return () => {\n subscription.unsubscribe();\n clearTimeout(lastTimeout);\n };\n },\n [cache, stableOptions, diff]\n ),\n getSnapshot,\n getSnapshot\n );\n}\n\nfunction diffToResult<TData>(\n diff: Cache.DiffResult<TData>\n): UseFragmentResult<TData> {\n const result = {\n data: diff.result!,\n complete: !!diff.complete,\n } as UseFragmentResult<TData>;\n\n if (diff.missing) {\n result.missing = mergeDeepArray(diff.missing.map((error) => error.missing));\n }\n\n return result;\n}\n"]}
|
|
@@ -85,7 +85,7 @@ import { ApolloError } from "../../core/index.js";
|
|
|
85
85
|
* @returns Query result object
|
|
86
86
|
*/
|
|
87
87
|
export declare function useSubscription<TData = any, TVariables extends OperationVariables = OperationVariables>(subscription: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: SubscriptionHookOptions<NoInfer<TData>, NoInfer<TVariables>>): {
|
|
88
|
-
restart()
|
|
88
|
+
restart: () => void;
|
|
89
89
|
loading: boolean;
|
|
90
90
|
data?: TData | undefined;
|
|
91
91
|
error?: ApolloError;
|
|
@@ -234,10 +234,11 @@ export function useSubscription(subscription, options) {
|
|
|
234
234
|
observable.__.result
|
|
235
235
|
: fallbackResult;
|
|
236
236
|
}, function () { return fallbackResult; });
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
237
|
+
var restart = React.useCallback(function () {
|
|
238
|
+
invariant(!optionsRef.current.skip, 57);
|
|
239
|
+
setObservable(recreateRef.current());
|
|
240
|
+
}, [optionsRef, recreateRef]);
|
|
241
|
+
return React.useMemo(function () { return (__assign(__assign({}, ret), { restart: restart })); }, [ret, restart]);
|
|
241
242
|
}
|
|
242
243
|
function createSubscription(client, query, variables, fetchPolicy, errorPolicy, context, extensions) {
|
|
243
244
|
var options = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSubscription.js","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AW,EAAE,EAAjB,CAAiB,CAAC;IACjC,CAAC,CAAC,EACF;QACE;;WAEG;QACH,EAAE,IAAA;KACH,CACF,CAAC;AACJ,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\nimport { equal } from \"@wry/equality\";\n\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport type {\n NoInfer,\n SubscriptionHookOptions,\n SubscriptionResult,\n} from \"../types/types.js\";\nimport type {\n ApolloClient,\n DefaultContext,\n ErrorPolicy,\n FetchPolicy,\n FetchResult,\n OperationVariables,\n} from \"../../core/index.js\";\nimport { ApolloError, Observable } from \"../../core/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { useDeepMemo } from \"./internal/useDeepMemo.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\nimport { toApolloError } from \"./useQuery.js\";\nimport { useIsomorphicLayoutEffect } from \"./internal/useIsomorphicLayoutEffect.js\";\n\n/**\n * > Refer to the [Subscriptions](https://www.apollographql.com/docs/react/data/subscriptions/) section for a more in-depth overview of `useSubscription`.\n *\n * @example\n * ```jsx\n * const COMMENTS_SUBSCRIPTION = gql`\n * subscription OnCommentAdded($repoFullName: String!) {\n * commentAdded(repoFullName: $repoFullName) {\n * id\n * content\n * }\n * }\n * `;\n *\n * function DontReadTheComments({ repoFullName }) {\n * const {\n * data: { commentAdded },\n * loading,\n * } = useSubscription(COMMENTS_SUBSCRIPTION, { variables: { repoFullName } });\n * return <h4>New comment: {!loading && commentAdded.content}</h4>;\n * }\n * ```\n * @remarks\n * #### Consider using `onData` instead of `useEffect`\n *\n * If you want to react to incoming data, please use the `onData` option instead of `useEffect`.\n * State updates you make inside a `useEffect` hook might cause additional rerenders, and `useEffect` is mostly meant for side effects of rendering, not as an event handler.\n * State updates made in an event handler like `onData` might - depending on the React version - be batched and cause only a single rerender.\n *\n * Consider the following component:\n *\n * ```jsx\n * export function Subscriptions() {\n * const { data, error, loading } = useSubscription(query);\n * const [accumulatedData, setAccumulatedData] = useState([]);\n *\n * useEffect(() => {\n * setAccumulatedData((prev) => [...prev, data]);\n * }, [data]);\n *\n * return (\n * <>\n * {loading && <p>Loading...</p>}\n * {JSON.stringify(accumulatedData, undefined, 2)}\n * </>\n * );\n * }\n * ```\n *\n * Instead of using `useEffect` here, we can re-write this component to use the `onData` callback function accepted in `useSubscription`'s `options` object:\n *\n * ```jsx\n * export function Subscriptions() {\n * const [accumulatedData, setAccumulatedData] = useState([]);\n * const { data, error, loading } = useSubscription(\n * query,\n * {\n * onData({ data }) {\n * setAccumulatedData((prev) => [...prev, data])\n * }\n * }\n * );\n *\n * return (\n * <>\n * {loading && <p>Loading...</p>}\n * {JSON.stringify(accumulatedData, undefined, 2)}\n * </>\n * );\n * }\n * ```\n *\n * > ⚠️ **Note:** The `useSubscription` option `onData` is available in Apollo Client >= 3.7. In previous versions, the equivalent option is named `onSubscriptionData`.\n *\n * Now, the first message will be added to the `accumulatedData` array since `onData` is called _before_ the component re-renders. React 18 automatic batching is still in effect and results in a single re-render, but with `onData` we can guarantee each message received after the component mounts is added to `accumulatedData`.\n *\n * @since 3.0.0\n * @param subscription - A GraphQL subscription document parsed into an AST by `gql`.\n * @param options - Options to control how the subscription is executed.\n * @returns Query result object\n */\nexport function useSubscription<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: SubscriptionHookOptions<\n NoInfer<TData>,\n NoInfer<TVariables>\n > = Object.create(null)\n) {\n const hasIssuedDeprecationWarningRef = React.useRef(false);\n const client = useApolloClient(options.client);\n verifyDocumentType(subscription, DocumentType.Subscription);\n\n if (!hasIssuedDeprecationWarningRef.current) {\n hasIssuedDeprecationWarningRef.current = true;\n\n if (options.onSubscriptionData) {\n invariant.warn(\n options.onData ?\n \"'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used.\"\n : \"'onSubscriptionData' is deprecated and will be removed in a future major version. Please use the 'onData' option instead.\"\n );\n }\n\n if (options.onSubscriptionComplete) {\n invariant.warn(\n options.onComplete ?\n \"'useSubscription' supports only the 'onSubscriptionComplete' or 'onComplete' option, but not both. Only the 'onComplete' option will be used.\"\n : \"'onSubscriptionComplete' is deprecated and will be removed in a future major version. Please use the 'onComplete' option instead.\"\n );\n }\n }\n\n const {\n skip,\n fetchPolicy,\n errorPolicy,\n shouldResubscribe,\n context,\n extensions,\n ignoreResults,\n } = options;\n const variables = useDeepMemo(() => options.variables, [options.variables]);\n\n const recreate = () =>\n createSubscription(\n client,\n subscription,\n variables,\n fetchPolicy,\n errorPolicy,\n context,\n extensions\n );\n\n let [observable, setObservable] = React.useState(\n options.skip ? null : recreate\n );\n\n const recreateRef = React.useRef(recreate);\n useIsomorphicLayoutEffect(() => {\n recreateRef.current = recreate;\n });\n\n if (skip) {\n if (observable) {\n setObservable((observable = null));\n }\n } else if (\n !observable ||\n ((client !== observable.__.client ||\n subscription !== observable.__.query ||\n fetchPolicy !== observable.__.fetchPolicy ||\n errorPolicy !== observable.__.errorPolicy ||\n !equal(variables, observable.__.variables)) &&\n (typeof shouldResubscribe === \"function\" ?\n !!shouldResubscribe(options!)\n : shouldResubscribe) !== false)\n ) {\n setObservable((observable = recreate()));\n }\n\n const optionsRef = React.useRef(options);\n React.useEffect(() => {\n optionsRef.current = options;\n });\n\n const fallbackLoading = !skip && !ignoreResults;\n const fallbackResult = React.useMemo<SubscriptionResult<TData, TVariables>>(\n () => ({\n loading: fallbackLoading,\n error: void 0,\n data: void 0,\n variables,\n }),\n [fallbackLoading, variables]\n );\n\n const ignoreResultsRef = React.useRef(ignoreResults);\n useIsomorphicLayoutEffect(() => {\n // We cannot reference `ignoreResults` directly in the effect below\n // it would add a dependency to the `useEffect` deps array, which means the\n // subscription would be recreated if `ignoreResults` changes\n // As a result, on resubscription, the last result would be re-delivered,\n // rendering the component one additional time, and re-triggering `onData`.\n // The same applies to `fetchPolicy`, which results in a new `observable`\n // being created. We cannot really avoid it in that case, but we can at least\n // avoid it for `ignoreResults`.\n ignoreResultsRef.current = ignoreResults;\n });\n\n const ret = useSyncExternalStore<SubscriptionResult<TData, TVariables>>(\n React.useCallback(\n (update) => {\n if (!observable) {\n return () => {};\n }\n\n let subscriptionStopped = false;\n const variables = observable.__.variables;\n const client = observable.__.client;\n const subscription = observable.subscribe({\n next(fetchResult) {\n if (subscriptionStopped) {\n return;\n }\n\n const result = {\n loading: false,\n // TODO: fetchResult.data can be null but SubscriptionResult.data\n // expects TData | undefined only\n data: fetchResult.data!,\n error: toApolloError(fetchResult),\n variables,\n };\n observable.__.setResult(result);\n if (!ignoreResultsRef.current) update();\n\n if (result.error) {\n optionsRef.current.onError?.(result.error);\n } else if (optionsRef.current.onData) {\n optionsRef.current.onData({\n client,\n data: result,\n });\n } else if (optionsRef.current.onSubscriptionData) {\n optionsRef.current.onSubscriptionData({\n client,\n subscriptionData: result,\n });\n }\n },\n error(error) {\n error =\n error instanceof ApolloError ? error : (\n new ApolloError({ protocolErrors: [error] })\n );\n if (!subscriptionStopped) {\n observable.__.setResult({\n loading: false,\n data: void 0,\n error,\n variables,\n });\n if (!ignoreResultsRef.current) update();\n optionsRef.current.onError?.(error);\n }\n },\n complete() {\n if (!subscriptionStopped) {\n if (optionsRef.current.onComplete) {\n optionsRef.current.onComplete();\n } else if (optionsRef.current.onSubscriptionComplete) {\n optionsRef.current.onSubscriptionComplete();\n }\n }\n },\n });\n\n return () => {\n // immediately stop receiving subscription values, but do not unsubscribe\n // until after a short delay in case another useSubscription hook is\n // reusing the same underlying observable and is about to subscribe\n subscriptionStopped = true;\n setTimeout(() => {\n subscription.unsubscribe();\n });\n };\n },\n [observable]\n ),\n () =>\n observable && !skip && !ignoreResults ?\n observable.__.result\n : fallbackResult,\n () => fallbackResult\n );\n return React.useMemo(\n () => ({\n ...ret,\n restart() {\n invariant(\n !optionsRef.current.skip,\n \"A subscription that is skipped cannot be restarted.\"\n );\n setObservable(recreateRef.current());\n },\n }),\n [ret]\n );\n}\n\nfunction createSubscription<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n client: ApolloClient<any>,\n query: TypedDocumentNode<TData, TVariables>,\n variables: TVariables | undefined,\n fetchPolicy: FetchPolicy | undefined,\n errorPolicy: ErrorPolicy | undefined,\n context: DefaultContext | undefined,\n extensions: Record<string, any> | undefined\n) {\n const options = {\n query,\n variables,\n fetchPolicy,\n errorPolicy,\n context,\n extensions,\n };\n const __ = {\n ...options,\n client,\n result: {\n loading: true,\n data: void 0,\n error: void 0,\n variables,\n } as SubscriptionResult<TData, TVariables>,\n setResult(result: SubscriptionResult<TData, TVariables>) {\n __.result = result;\n },\n };\n\n let observable: Observable<FetchResult<TData>> | null = null;\n return Object.assign(\n new Observable<FetchResult<TData>>((observer) => {\n // lazily start the subscription when the first observer subscribes\n // to get around strict mode\n if (!observable) {\n observable = client.subscribe(options);\n }\n const sub = observable.subscribe(observer);\n return () => sub.unsubscribe();\n }),\n {\n /**\n * A tracking object to store details about the observable and the latest result of the subscription.\n */\n __,\n }\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useSubscription.js","sourceRoot":"","sources":["../../../src/react/hooks/useSubscription.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAGjC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AActE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,oBAAoB,EA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E,OAAO,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,kBAAkB,CAIzB,MAAyB,EACzB,KAA2C,EAC3C,SAAiC,EACjC,WAAoC,EACpC,WAAoC,EACpC,OAAmC,EACnC,UAA2C;IAE3C,IAAM,OAAO,GAAG;QACd,KAAK,OAAA;QACL,SAAS,WAAA;QACT,WAAW,aAAA;QACX,WAAW,aAAA;QACX,OAAO,SAAA;QACP,UAAU,YAAA;KACX,CAAC;IACF,IAAM,EAAE,yBACH,OAAO,KACV,MAAM,QAAA,EACN,MAAM,EAAE;YACN,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,KAAK,CAAC;YACZ,KAAK,EAAE,KAAK,CAAC;YACb,SAAS,WAAA;SAC+B,EAC1C,SAAS,YAAC,MAA6C;YACrD,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,CAAC,GACF,CAAC;IAEF,IAAI,UAAU,GAA0C,IAAI,CAAC;IAC7D,OAAO,MAAM,CAAC,MAAM,CAClB,IAAI,UAAU,CAAqB,UAAC,QAAQ;QAC1C,mEAAmE;QACnE,4BAA4B;QAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;QACD,IAAM,GAAG,GAAG,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC3C,OAAO,cAAM,OAAA,GAAG,CAAC,WAAW,EAAE,EAAjB,CAAiB,CAAC;IACjC,CAAC,CAAC,EACF;QACE;;WAEG;QACH,EAAE,IAAA;KACH,CACF,CAAC;AACJ,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\nimport { equal } from \"@wry/equality\";\n\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport type {\n NoInfer,\n SubscriptionHookOptions,\n SubscriptionResult,\n} from \"../types/types.js\";\nimport type {\n ApolloClient,\n DefaultContext,\n ErrorPolicy,\n FetchPolicy,\n FetchResult,\n OperationVariables,\n} from \"../../core/index.js\";\nimport { ApolloError, Observable } from \"../../core/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { useDeepMemo } from \"./internal/useDeepMemo.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\nimport { toApolloError } from \"./useQuery.js\";\nimport { useIsomorphicLayoutEffect } from \"./internal/useIsomorphicLayoutEffect.js\";\n\n/**\n * > Refer to the [Subscriptions](https://www.apollographql.com/docs/react/data/subscriptions/) section for a more in-depth overview of `useSubscription`.\n *\n * @example\n * ```jsx\n * const COMMENTS_SUBSCRIPTION = gql`\n * subscription OnCommentAdded($repoFullName: String!) {\n * commentAdded(repoFullName: $repoFullName) {\n * id\n * content\n * }\n * }\n * `;\n *\n * function DontReadTheComments({ repoFullName }) {\n * const {\n * data: { commentAdded },\n * loading,\n * } = useSubscription(COMMENTS_SUBSCRIPTION, { variables: { repoFullName } });\n * return <h4>New comment: {!loading && commentAdded.content}</h4>;\n * }\n * ```\n * @remarks\n * #### Consider using `onData` instead of `useEffect`\n *\n * If you want to react to incoming data, please use the `onData` option instead of `useEffect`.\n * State updates you make inside a `useEffect` hook might cause additional rerenders, and `useEffect` is mostly meant for side effects of rendering, not as an event handler.\n * State updates made in an event handler like `onData` might - depending on the React version - be batched and cause only a single rerender.\n *\n * Consider the following component:\n *\n * ```jsx\n * export function Subscriptions() {\n * const { data, error, loading } = useSubscription(query);\n * const [accumulatedData, setAccumulatedData] = useState([]);\n *\n * useEffect(() => {\n * setAccumulatedData((prev) => [...prev, data]);\n * }, [data]);\n *\n * return (\n * <>\n * {loading && <p>Loading...</p>}\n * {JSON.stringify(accumulatedData, undefined, 2)}\n * </>\n * );\n * }\n * ```\n *\n * Instead of using `useEffect` here, we can re-write this component to use the `onData` callback function accepted in `useSubscription`'s `options` object:\n *\n * ```jsx\n * export function Subscriptions() {\n * const [accumulatedData, setAccumulatedData] = useState([]);\n * const { data, error, loading } = useSubscription(\n * query,\n * {\n * onData({ data }) {\n * setAccumulatedData((prev) => [...prev, data])\n * }\n * }\n * );\n *\n * return (\n * <>\n * {loading && <p>Loading...</p>}\n * {JSON.stringify(accumulatedData, undefined, 2)}\n * </>\n * );\n * }\n * ```\n *\n * > ⚠️ **Note:** The `useSubscription` option `onData` is available in Apollo Client >= 3.7. In previous versions, the equivalent option is named `onSubscriptionData`.\n *\n * Now, the first message will be added to the `accumulatedData` array since `onData` is called _before_ the component re-renders. React 18 automatic batching is still in effect and results in a single re-render, but with `onData` we can guarantee each message received after the component mounts is added to `accumulatedData`.\n *\n * @since 3.0.0\n * @param subscription - A GraphQL subscription document parsed into an AST by `gql`.\n * @param options - Options to control how the subscription is executed.\n * @returns Query result object\n */\nexport function useSubscription<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: SubscriptionHookOptions<\n NoInfer<TData>,\n NoInfer<TVariables>\n > = Object.create(null)\n) {\n const hasIssuedDeprecationWarningRef = React.useRef(false);\n const client = useApolloClient(options.client);\n verifyDocumentType(subscription, DocumentType.Subscription);\n\n if (!hasIssuedDeprecationWarningRef.current) {\n hasIssuedDeprecationWarningRef.current = true;\n\n if (options.onSubscriptionData) {\n invariant.warn(\n options.onData ?\n \"'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used.\"\n : \"'onSubscriptionData' is deprecated and will be removed in a future major version. Please use the 'onData' option instead.\"\n );\n }\n\n if (options.onSubscriptionComplete) {\n invariant.warn(\n options.onComplete ?\n \"'useSubscription' supports only the 'onSubscriptionComplete' or 'onComplete' option, but not both. Only the 'onComplete' option will be used.\"\n : \"'onSubscriptionComplete' is deprecated and will be removed in a future major version. Please use the 'onComplete' option instead.\"\n );\n }\n }\n\n const {\n skip,\n fetchPolicy,\n errorPolicy,\n shouldResubscribe,\n context,\n extensions,\n ignoreResults,\n } = options;\n const variables = useDeepMemo(() => options.variables, [options.variables]);\n\n const recreate = () =>\n createSubscription(\n client,\n subscription,\n variables,\n fetchPolicy,\n errorPolicy,\n context,\n extensions\n );\n\n let [observable, setObservable] = React.useState(\n options.skip ? null : recreate\n );\n\n const recreateRef = React.useRef(recreate);\n useIsomorphicLayoutEffect(() => {\n recreateRef.current = recreate;\n });\n\n if (skip) {\n if (observable) {\n setObservable((observable = null));\n }\n } else if (\n !observable ||\n ((client !== observable.__.client ||\n subscription !== observable.__.query ||\n fetchPolicy !== observable.__.fetchPolicy ||\n errorPolicy !== observable.__.errorPolicy ||\n !equal(variables, observable.__.variables)) &&\n (typeof shouldResubscribe === \"function\" ?\n !!shouldResubscribe(options!)\n : shouldResubscribe) !== false)\n ) {\n setObservable((observable = recreate()));\n }\n\n const optionsRef = React.useRef(options);\n React.useEffect(() => {\n optionsRef.current = options;\n });\n\n const fallbackLoading = !skip && !ignoreResults;\n const fallbackResult = React.useMemo<SubscriptionResult<TData, TVariables>>(\n () => ({\n loading: fallbackLoading,\n error: void 0,\n data: void 0,\n variables,\n }),\n [fallbackLoading, variables]\n );\n\n const ignoreResultsRef = React.useRef(ignoreResults);\n useIsomorphicLayoutEffect(() => {\n // We cannot reference `ignoreResults` directly in the effect below\n // it would add a dependency to the `useEffect` deps array, which means the\n // subscription would be recreated if `ignoreResults` changes\n // As a result, on resubscription, the last result would be re-delivered,\n // rendering the component one additional time, and re-triggering `onData`.\n // The same applies to `fetchPolicy`, which results in a new `observable`\n // being created. We cannot really avoid it in that case, but we can at least\n // avoid it for `ignoreResults`.\n ignoreResultsRef.current = ignoreResults;\n });\n\n const ret = useSyncExternalStore<SubscriptionResult<TData, TVariables>>(\n React.useCallback(\n (update) => {\n if (!observable) {\n return () => {};\n }\n\n let subscriptionStopped = false;\n const variables = observable.__.variables;\n const client = observable.__.client;\n const subscription = observable.subscribe({\n next(fetchResult) {\n if (subscriptionStopped) {\n return;\n }\n\n const result = {\n loading: false,\n // TODO: fetchResult.data can be null but SubscriptionResult.data\n // expects TData | undefined only\n data: fetchResult.data!,\n error: toApolloError(fetchResult),\n variables,\n };\n observable.__.setResult(result);\n if (!ignoreResultsRef.current) update();\n\n if (result.error) {\n optionsRef.current.onError?.(result.error);\n } else if (optionsRef.current.onData) {\n optionsRef.current.onData({\n client,\n data: result,\n });\n } else if (optionsRef.current.onSubscriptionData) {\n optionsRef.current.onSubscriptionData({\n client,\n subscriptionData: result,\n });\n }\n },\n error(error) {\n error =\n error instanceof ApolloError ? error : (\n new ApolloError({ protocolErrors: [error] })\n );\n if (!subscriptionStopped) {\n observable.__.setResult({\n loading: false,\n data: void 0,\n error,\n variables,\n });\n if (!ignoreResultsRef.current) update();\n optionsRef.current.onError?.(error);\n }\n },\n complete() {\n if (!subscriptionStopped) {\n if (optionsRef.current.onComplete) {\n optionsRef.current.onComplete();\n } else if (optionsRef.current.onSubscriptionComplete) {\n optionsRef.current.onSubscriptionComplete();\n }\n }\n },\n });\n\n return () => {\n // immediately stop receiving subscription values, but do not unsubscribe\n // until after a short delay in case another useSubscription hook is\n // reusing the same underlying observable and is about to subscribe\n subscriptionStopped = true;\n setTimeout(() => {\n subscription.unsubscribe();\n });\n };\n },\n [observable]\n ),\n () =>\n observable && !skip && !ignoreResults ?\n observable.__.result\n : fallbackResult,\n () => fallbackResult\n );\n\n const restart = React.useCallback(() => {\n invariant(\n !optionsRef.current.skip,\n \"A subscription that is skipped cannot be restarted.\"\n );\n setObservable(recreateRef.current());\n }, [optionsRef, recreateRef]);\n\n return React.useMemo(() => ({ ...ret, restart }), [ret, restart]);\n}\n\nfunction createSubscription<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n client: ApolloClient<any>,\n query: TypedDocumentNode<TData, TVariables>,\n variables: TVariables | undefined,\n fetchPolicy: FetchPolicy | undefined,\n errorPolicy: ErrorPolicy | undefined,\n context: DefaultContext | undefined,\n extensions: Record<string, any> | undefined\n) {\n const options = {\n query,\n variables,\n fetchPolicy,\n errorPolicy,\n context,\n extensions,\n };\n const __ = {\n ...options,\n client,\n result: {\n loading: true,\n data: void 0,\n error: void 0,\n variables,\n } as SubscriptionResult<TData, TVariables>,\n setResult(result: SubscriptionResult<TData, TVariables>) {\n __.result = result;\n },\n };\n\n let observable: Observable<FetchResult<TData>> | null = null;\n return Object.assign(\n new Observable<FetchResult<TData>>((observer) => {\n // lazily start the subscription when the first observer subscribes\n // to get around strict mode\n if (!observable) {\n observable = client.subscribe(options);\n }\n const sub = observable.subscribe(observer);\n return () => sub.unsubscribe();\n }),\n {\n /**\n * A tracking object to store details about the observable and the latest result of the subscription.\n */\n __,\n }\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.cjs","sources":["../../version.js","../../utilities/globals/maybe.js","../../utilities/globals/global.js","../../utilities/common/makeUniqueId.js","../../utilities/common/stringifyForDisplay.js","../../utilities/globals/invariantWrappers.js","cache/QueryReference.js","cache/SuspenseCache.js","cache/getSuspenseCache.js"],"sourcesContent":["export var version = \"3.11.4\";\n//# sourceMappingURL=version.js.map","export function maybe(thunk) {\n try {\n return thunk();\n }\n catch (_a) { }\n}\n//# sourceMappingURL=maybe.js.map","import { maybe } from \"./maybe.js\";\nexport default (maybe(function () { return globalThis; }) ||\n maybe(function () { return window; }) ||\n maybe(function () { return self; }) ||\n maybe(function () { return global; }) || // We don't expect the Function constructor ever to be invoked at runtime, as\n// long as at least one of globalThis, window, self, or global is defined, so\n// we are under no obligation to make it easy for static analysis tools to\n// detect syntactic usage of the Function constructor. If you think you can\n// improve your static analysis to detect this obfuscation, think again. This\n// is an arms race you cannot win, at least not in JavaScript.\nmaybe(function () {\n return maybe.constructor(\"return this\")();\n}));\n//# sourceMappingURL=global.js.map","var prefixCounts = new Map();\n// These IDs won't be globally unique, but they will be unique within this\n// process, thanks to the counter, and unguessable thanks to the random suffix.\nexport function makeUniqueId(prefix) {\n var count = prefixCounts.get(prefix) || 1;\n prefixCounts.set(prefix, count + 1);\n return \"\".concat(prefix, \":\").concat(count, \":\").concat(Math.random().toString(36).slice(2));\n}\n//# sourceMappingURL=makeUniqueId.js.map","import { makeUniqueId } from \"./makeUniqueId.js\";\nexport function stringifyForDisplay(value, space) {\n if (space === void 0) { space = 0; }\n var undefId = makeUniqueId(\"stringifyForDisplay\");\n return JSON.stringify(value, function (key, value) {\n return value === void 0 ? undefId : value;\n }, space)\n .split(JSON.stringify(undefId))\n .join(\"<undefined>\");\n}\n//# sourceMappingURL=stringifyForDisplay.js.map","import { invariant as originalInvariant, InvariantError } from \"ts-invariant\";\nimport { version } from \"../../version.js\";\nimport global from \"./global.js\";\nimport { stringifyForDisplay } from \"../common/stringifyForDisplay.js\";\nfunction wrap(fn) {\n return function (message) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (typeof message === \"number\") {\n var arg0 = message;\n message = getHandledErrorMsg(arg0);\n if (!message) {\n message = getFallbackErrorMsg(arg0, args);\n args = [];\n }\n }\n fn.apply(void 0, [message].concat(args));\n };\n}\nvar invariant = Object.assign(function invariant(condition, message) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n if (!condition) {\n originalInvariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args));\n }\n}, {\n debug: wrap(originalInvariant.debug),\n log: wrap(originalInvariant.log),\n warn: wrap(originalInvariant.warn),\n error: wrap(originalInvariant.error),\n});\n/**\n * Returns an InvariantError.\n *\n * `message` can only be a string, a concatenation of strings, or a ternary statement\n * that results in a string. This will be enforced on build, where the message will\n * be replaced with a message number.\n * String substitutions with %s are supported and will also return\n * pretty-stringified objects.\n * Excess `optionalParams` will be swallowed.\n */\nfunction newInvariantError(message) {\n var optionalParams = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n optionalParams[_i - 1] = arguments[_i];\n }\n return new InvariantError(getHandledErrorMsg(message, optionalParams) ||\n getFallbackErrorMsg(message, optionalParams));\n}\nvar ApolloErrorMessageHandler = Symbol.for(\"ApolloErrorMessageHandler_\" + version);\nfunction stringify(arg) {\n if (typeof arg == \"string\") {\n return arg;\n }\n try {\n return stringifyForDisplay(arg, 2).slice(0, 1000);\n }\n catch (_a) {\n return \"<non-serializable>\";\n }\n}\nfunction getHandledErrorMsg(message, messageArgs) {\n if (messageArgs === void 0) { messageArgs = []; }\n if (!message)\n return;\n return (global[ApolloErrorMessageHandler] &&\n global[ApolloErrorMessageHandler](message, messageArgs.map(stringify)));\n}\nfunction getFallbackErrorMsg(message, messageArgs) {\n if (messageArgs === void 0) { messageArgs = []; }\n if (!message)\n return;\n return \"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#\".concat(encodeURIComponent(JSON.stringify({\n version: version,\n message: message,\n args: messageArgs.map(stringify),\n })));\n}\nexport { invariant, InvariantError, newInvariantError, ApolloErrorMessageHandler, };\n//# sourceMappingURL=invariantWrappers.js.map","import { __assign } from \"tslib\";\nimport { equal } from \"@wry/equality\";\nimport { createFulfilledPromise, createRejectedPromise, } from \"../../../utilities/index.js\";\nimport { wrapPromiseWithState } from \"../../../utilities/index.js\";\nimport { invariant } from \"../../../utilities/globals/invariantWrappers.js\";\nvar QUERY_REFERENCE_SYMBOL = Symbol();\nvar PROMISE_SYMBOL = Symbol();\nexport function wrapQueryRef(internalQueryRef) {\n var _a;\n var ref = (_a = {\n toPromise: function () {\n // We avoid resolving this promise with the query data because we want to\n // discourage using the server data directly from the queryRef. Instead,\n // the data should be accessed through `useReadQuery`. When the server\n // data is needed, its better to use `client.query()` directly.\n //\n // Here we resolve with the ref itself to make using this in React Router\n // or TanStack Router `loader` functions a bit more ergonomic e.g.\n //\n // function loader() {\n // return { queryRef: await preloadQuery(query).toPromise() }\n // }\n return getWrappedPromise(ref).then(function () { return ref; });\n }\n },\n _a[QUERY_REFERENCE_SYMBOL] = internalQueryRef,\n _a[PROMISE_SYMBOL] = internalQueryRef.promise,\n _a);\n return ref;\n}\nexport function assertWrappedQueryRef(queryRef) {\n invariant(!queryRef || QUERY_REFERENCE_SYMBOL in queryRef, 61);\n}\nexport function getWrappedPromise(queryRef) {\n var internalQueryRef = unwrapQueryRef(queryRef);\n return internalQueryRef.promise.status === \"fulfilled\" ?\n internalQueryRef.promise\n : queryRef[PROMISE_SYMBOL];\n}\nexport function unwrapQueryRef(queryRef) {\n return queryRef[QUERY_REFERENCE_SYMBOL];\n}\nexport function updateWrappedQueryRef(queryRef, promise) {\n queryRef[PROMISE_SYMBOL] = promise;\n}\nvar OBSERVED_CHANGED_OPTIONS = [\n \"canonizeResults\",\n \"context\",\n \"errorPolicy\",\n \"fetchPolicy\",\n \"refetchWritePolicy\",\n \"returnPartialData\",\n];\nvar InternalQueryReference = /** @class */ (function () {\n function InternalQueryReference(observable, options) {\n var _this = this;\n this.key = {};\n this.listeners = new Set();\n this.references = 0;\n this.softReferences = 0;\n this.handleNext = this.handleNext.bind(this);\n this.handleError = this.handleError.bind(this);\n this.dispose = this.dispose.bind(this);\n this.observable = observable;\n if (options.onDispose) {\n this.onDispose = options.onDispose;\n }\n this.setResult();\n this.subscribeToQuery();\n // Start a timer that will automatically dispose of the query if the\n // suspended resource does not use this queryRef in the given time. This\n // helps prevent memory leaks when a component has unmounted before the\n // query has finished loading.\n var startDisposeTimer = function () {\n var _a;\n if (!_this.references) {\n _this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);\n }\n };\n // We wait until the request has settled to ensure we don't dispose of the\n // query ref before the request finishes, otherwise we would leave the\n // promise in a pending state rendering the suspense boundary indefinitely.\n this.promise.then(startDisposeTimer, startDisposeTimer);\n }\n Object.defineProperty(InternalQueryReference.prototype, \"disposed\", {\n get: function () {\n return this.subscription.closed;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(InternalQueryReference.prototype, \"watchQueryOptions\", {\n get: function () {\n return this.observable.options;\n },\n enumerable: false,\n configurable: true\n });\n InternalQueryReference.prototype.reinitialize = function () {\n var observable = this.observable;\n var originalFetchPolicy = this.watchQueryOptions.fetchPolicy;\n var avoidNetworkRequests = originalFetchPolicy === \"no-cache\" || originalFetchPolicy === \"standby\";\n try {\n if (avoidNetworkRequests) {\n observable.silentSetOptions({ fetchPolicy: \"standby\" });\n }\n else {\n observable.resetLastResults();\n observable.silentSetOptions({ fetchPolicy: \"cache-first\" });\n }\n this.subscribeToQuery();\n if (avoidNetworkRequests) {\n return;\n }\n observable.resetDiff();\n this.setResult();\n }\n finally {\n observable.silentSetOptions({ fetchPolicy: originalFetchPolicy });\n }\n };\n InternalQueryReference.prototype.retain = function () {\n var _this = this;\n this.references++;\n clearTimeout(this.autoDisposeTimeoutId);\n var disposed = false;\n return function () {\n if (disposed) {\n return;\n }\n disposed = true;\n _this.references--;\n setTimeout(function () {\n if (!_this.references) {\n _this.dispose();\n }\n });\n };\n };\n InternalQueryReference.prototype.softRetain = function () {\n var _this = this;\n this.softReferences++;\n var disposed = false;\n return function () {\n // Tracking if this has already been called helps ensure that\n // multiple calls to this function won't decrement the reference\n // counter more than it should. Subsequent calls just result in a noop.\n if (disposed) {\n return;\n }\n disposed = true;\n _this.softReferences--;\n setTimeout(function () {\n if (!_this.softReferences && !_this.references) {\n _this.dispose();\n }\n });\n };\n };\n InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) {\n var _this = this;\n return OBSERVED_CHANGED_OPTIONS.some(function (option) {\n return option in watchQueryOptions &&\n !equal(_this.watchQueryOptions[option], watchQueryOptions[option]);\n });\n };\n InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) {\n var _a = this.watchQueryOptions, currentFetchPolicy = _a.fetchPolicy, currentCanonizeResults = _a.canonizeResults;\n // \"standby\" is used when `skip` is set to `true`. Detect when we've\n // enabled the query (i.e. `skip` is `false`) to execute a network request.\n if (currentFetchPolicy === \"standby\" &&\n currentFetchPolicy !== watchQueryOptions.fetchPolicy) {\n this.initiateFetch(this.observable.reobserve(watchQueryOptions));\n }\n else {\n this.observable.silentSetOptions(watchQueryOptions);\n if (currentCanonizeResults !== watchQueryOptions.canonizeResults) {\n this.result = __assign(__assign({}, this.result), this.observable.getCurrentResult());\n this.promise = createFulfilledPromise(this.result);\n }\n }\n return this.promise;\n };\n InternalQueryReference.prototype.listen = function (listener) {\n var _this = this;\n this.listeners.add(listener);\n return function () {\n _this.listeners.delete(listener);\n };\n };\n InternalQueryReference.prototype.refetch = function (variables) {\n return this.initiateFetch(this.observable.refetch(variables));\n };\n InternalQueryReference.prototype.fetchMore = function (options) {\n return this.initiateFetch(this.observable.fetchMore(options));\n };\n InternalQueryReference.prototype.dispose = function () {\n this.subscription.unsubscribe();\n this.onDispose();\n };\n InternalQueryReference.prototype.onDispose = function () {\n // noop. overridable by options\n };\n InternalQueryReference.prototype.handleNext = function (result) {\n var _a;\n switch (this.promise.status) {\n case \"pending\": {\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.result = result;\n (_a = this.resolve) === null || _a === void 0 ? void 0 : _a.call(this, result);\n break;\n }\n default: {\n // This occurs when switching to a result that is fully cached when this\n // class is instantiated. ObservableQuery will run reobserve when\n // subscribing, which delivers a result from the cache.\n if (result.data === this.result.data &&\n result.networkStatus === this.result.networkStatus) {\n return;\n }\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.result = result;\n this.promise = createFulfilledPromise(result);\n this.deliver(this.promise);\n break;\n }\n }\n };\n InternalQueryReference.prototype.handleError = function (error) {\n var _a;\n this.subscription.unsubscribe();\n this.subscription = this.observable.resubscribeAfterError(this.handleNext, this.handleError);\n switch (this.promise.status) {\n case \"pending\": {\n (_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this, error);\n break;\n }\n default: {\n this.promise = createRejectedPromise(error);\n this.deliver(this.promise);\n }\n }\n };\n InternalQueryReference.prototype.deliver = function (promise) {\n this.listeners.forEach(function (listener) { return listener(promise); });\n };\n InternalQueryReference.prototype.initiateFetch = function (returnedPromise) {\n var _this = this;\n this.promise = this.createPendingPromise();\n this.promise.catch(function () { });\n // If the data returned from the fetch is deeply equal to the data already\n // in the cache, `handleNext` will not be triggered leaving the promise we\n // created in a pending state forever. To avoid this situtation, we attempt\n // to resolve the promise if `handleNext` hasn't been run to ensure the\n // promise is resolved correctly.\n returnedPromise\n .then(function () {\n // In the case of `fetchMore`, this promise is resolved before a cache\n // result is emitted due to the fact that `fetchMore` sets a `no-cache`\n // fetch policy and runs `cache.batch` in its `.then` handler. Because\n // the timing is different, we accidentally run this update twice\n // causing an additional re-render with the `fetchMore` result by\n // itself. By wrapping in `setTimeout`, this should provide a short\n // delay to allow the `QueryInfo.notify` handler to run before this\n // promise is checked.\n // See https://github.com/apollographql/apollo-client/issues/11315 for\n // more information\n setTimeout(function () {\n var _a;\n if (_this.promise.status === \"pending\") {\n // Use the current result from the observable instead of the value\n // resolved from the promise. This avoids issues in some cases where\n // the raw resolved value should not be the emitted value, such as\n // when a `fetchMore` call returns an empty array after it has\n // reached the end of the list.\n //\n // See the following for more information:\n // https://github.com/apollographql/apollo-client/issues/11642\n _this.result = _this.observable.getCurrentResult();\n (_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, _this.result);\n }\n });\n })\n .catch(function () { });\n return returnedPromise;\n };\n InternalQueryReference.prototype.subscribeToQuery = function () {\n var _this = this;\n this.subscription = this.observable\n .filter(function (result) { return !equal(result.data, {}) && !equal(result, _this.result); })\n .subscribe(this.handleNext, this.handleError);\n };\n InternalQueryReference.prototype.setResult = function () {\n // Don't save this result as last result to prevent delivery of last result\n // when first subscribing\n var result = this.observable.getCurrentResult(false);\n if (equal(result, this.result)) {\n return;\n }\n this.result = result;\n this.promise =\n (result.data &&\n (!result.partial || this.watchQueryOptions.returnPartialData)) ?\n createFulfilledPromise(result)\n : this.createPendingPromise();\n };\n InternalQueryReference.prototype.createPendingPromise = function () {\n var _this = this;\n return wrapPromiseWithState(new Promise(function (resolve, reject) {\n _this.resolve = resolve;\n _this.reject = reject;\n }));\n };\n return InternalQueryReference;\n}());\nexport { InternalQueryReference };\n//# sourceMappingURL=QueryReference.js.map","import { Trie } from \"@wry/trie\";\nimport { canUseWeakMap } from \"../../../utilities/index.js\";\nimport { InternalQueryReference } from \"./QueryReference.js\";\nvar SuspenseCache = /** @class */ (function () {\n function SuspenseCache(options) {\n if (options === void 0) { options = Object.create(null); }\n this.queryRefs = new Trie(canUseWeakMap);\n this.options = options;\n }\n SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) {\n var ref = this.queryRefs.lookupArray(cacheKey);\n if (!ref.current) {\n ref.current = new InternalQueryReference(createObservable(), {\n autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,\n onDispose: function () {\n delete ref.current;\n },\n });\n }\n return ref.current;\n };\n SuspenseCache.prototype.add = function (cacheKey, queryRef) {\n var ref = this.queryRefs.lookupArray(cacheKey);\n ref.current = queryRef;\n };\n return SuspenseCache;\n}());\nexport { SuspenseCache };\n//# sourceMappingURL=SuspenseCache.js.map","import { SuspenseCache } from \"./SuspenseCache.js\";\nvar suspenseCacheSymbol = Symbol.for(\"apollo.suspenseCache\");\nexport function getSuspenseCache(client) {\n var _a;\n if (!client[suspenseCacheSymbol]) {\n client[suspenseCacheSymbol] = new SuspenseCache((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense);\n }\n return client[suspenseCacheSymbol];\n}\n//# sourceMappingURL=getSuspenseCache.js.map"],"names":["originalInvariant","global","equal","__assign","createFulfilledPromise","createRejectedPromise","wrapPromiseWithState","Trie","canUseWeakMap"],"mappings":";;;;;;;;;;AAAO,IAAI,OAAO,GAAG,QAAQ;;ACAtB,SAAS,KAAK,CAAC,KAAK,EAAE;AAC7B,IAAI,IAAI;AACR,QAAQ,OAAO,KAAK,EAAE,CAAC;AACvB,KAAK;AACL,IAAI,OAAO,EAAE,EAAE,G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GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AACtD,SAAS,gBAAgB,CAAC,MAAM,EAAE;AACzC,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE;AACtC,QAAQ,MAAM,CAAC,mBAAmB,CAAC,GAAG,IAAI,aAAa,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;AAC7I,KAAK;AACL,IAAI,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACvC;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"internal.cjs","sources":["../../version.js","../../utilities/globals/maybe.js","../../utilities/globals/global.js","../../utilities/common/makeUniqueId.js","../../utilities/common/stringifyForDisplay.js","../../utilities/globals/invariantWrappers.js","cache/QueryReference.js","cache/SuspenseCache.js","cache/getSuspenseCache.js"],"sourcesContent":["export var version = \"3.11.6\";\n//# sourceMappingURL=version.js.map","export function maybe(thunk) {\n try {\n return thunk();\n }\n catch (_a) { }\n}\n//# sourceMappingURL=maybe.js.map","import { maybe } from \"./maybe.js\";\nexport default (maybe(function () { return globalThis; }) ||\n maybe(function () { return window; }) ||\n maybe(function () { return self; }) ||\n maybe(function () { return global; }) || // We don't expect the Function constructor ever to be invoked at runtime, as\n// long as at least one of globalThis, window, self, or global is defined, so\n// we are under no obligation to make it easy for static analysis tools to\n// detect syntactic usage of the Function constructor. If you think you can\n// improve your static analysis to detect this obfuscation, think again. This\n// is an arms race you cannot win, at least not in JavaScript.\nmaybe(function () {\n return maybe.constructor(\"return this\")();\n}));\n//# sourceMappingURL=global.js.map","var prefixCounts = new Map();\n// These IDs won't be globally unique, but they will be unique within this\n// process, thanks to the counter, and unguessable thanks to the random suffix.\nexport function makeUniqueId(prefix) {\n var count = prefixCounts.get(prefix) || 1;\n prefixCounts.set(prefix, count + 1);\n return \"\".concat(prefix, \":\").concat(count, \":\").concat(Math.random().toString(36).slice(2));\n}\n//# sourceMappingURL=makeUniqueId.js.map","import { makeUniqueId } from \"./makeUniqueId.js\";\nexport function stringifyForDisplay(value, space) {\n if (space === void 0) { space = 0; }\n var undefId = makeUniqueId(\"stringifyForDisplay\");\n return JSON.stringify(value, function (key, value) {\n return value === void 0 ? undefId : value;\n }, space)\n .split(JSON.stringify(undefId))\n .join(\"<undefined>\");\n}\n//# sourceMappingURL=stringifyForDisplay.js.map","import { invariant as originalInvariant, InvariantError } from \"ts-invariant\";\nimport { version } from \"../../version.js\";\nimport global from \"./global.js\";\nimport { stringifyForDisplay } from \"../common/stringifyForDisplay.js\";\nfunction wrap(fn) {\n return function (message) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (typeof message === \"number\") {\n var arg0 = message;\n message = getHandledErrorMsg(arg0);\n if (!message) {\n message = getFallbackErrorMsg(arg0, args);\n args = [];\n }\n }\n fn.apply(void 0, [message].concat(args));\n };\n}\nvar invariant = Object.assign(function invariant(condition, message) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n if (!condition) {\n originalInvariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args));\n }\n}, {\n debug: wrap(originalInvariant.debug),\n log: wrap(originalInvariant.log),\n warn: wrap(originalInvariant.warn),\n error: wrap(originalInvariant.error),\n});\n/**\n * Returns an InvariantError.\n *\n * `message` can only be a string, a concatenation of strings, or a ternary statement\n * that results in a string. This will be enforced on build, where the message will\n * be replaced with a message number.\n * String substitutions with %s are supported and will also return\n * pretty-stringified objects.\n * Excess `optionalParams` will be swallowed.\n */\nfunction newInvariantError(message) {\n var optionalParams = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n optionalParams[_i - 1] = arguments[_i];\n }\n return new InvariantError(getHandledErrorMsg(message, optionalParams) ||\n getFallbackErrorMsg(message, optionalParams));\n}\nvar ApolloErrorMessageHandler = Symbol.for(\"ApolloErrorMessageHandler_\" + version);\nfunction stringify(arg) {\n if (typeof arg == \"string\") {\n return arg;\n }\n try {\n return stringifyForDisplay(arg, 2).slice(0, 1000);\n }\n catch (_a) {\n return \"<non-serializable>\";\n }\n}\nfunction getHandledErrorMsg(message, messageArgs) {\n if (messageArgs === void 0) { messageArgs = []; }\n if (!message)\n return;\n return (global[ApolloErrorMessageHandler] &&\n global[ApolloErrorMessageHandler](message, messageArgs.map(stringify)));\n}\nfunction getFallbackErrorMsg(message, messageArgs) {\n if (messageArgs === void 0) { messageArgs = []; }\n if (!message)\n return;\n return \"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#\".concat(encodeURIComponent(JSON.stringify({\n version: version,\n message: message,\n args: messageArgs.map(stringify),\n })));\n}\nexport { invariant, InvariantError, newInvariantError, ApolloErrorMessageHandler, };\n//# sourceMappingURL=invariantWrappers.js.map","import { __assign } from \"tslib\";\nimport { equal } from \"@wry/equality\";\nimport { createFulfilledPromise, createRejectedPromise, } from \"../../../utilities/index.js\";\nimport { wrapPromiseWithState } from \"../../../utilities/index.js\";\nimport { invariant } from \"../../../utilities/globals/invariantWrappers.js\";\nvar QUERY_REFERENCE_SYMBOL = Symbol();\nvar PROMISE_SYMBOL = Symbol();\nexport function wrapQueryRef(internalQueryRef) {\n var _a;\n var ref = (_a = {\n toPromise: function () {\n // We avoid resolving this promise with the query data because we want to\n // discourage using the server data directly from the queryRef. Instead,\n // the data should be accessed through `useReadQuery`. When the server\n // data is needed, its better to use `client.query()` directly.\n //\n // Here we resolve with the ref itself to make using this in React Router\n // or TanStack Router `loader` functions a bit more ergonomic e.g.\n //\n // function loader() {\n // return { queryRef: await preloadQuery(query).toPromise() }\n // }\n return getWrappedPromise(ref).then(function () { return ref; });\n }\n },\n _a[QUERY_REFERENCE_SYMBOL] = internalQueryRef,\n _a[PROMISE_SYMBOL] = internalQueryRef.promise,\n _a);\n return ref;\n}\nexport function assertWrappedQueryRef(queryRef) {\n invariant(!queryRef || QUERY_REFERENCE_SYMBOL in queryRef, 61);\n}\nexport function getWrappedPromise(queryRef) {\n var internalQueryRef = unwrapQueryRef(queryRef);\n return internalQueryRef.promise.status === \"fulfilled\" ?\n internalQueryRef.promise\n : queryRef[PROMISE_SYMBOL];\n}\nexport function unwrapQueryRef(queryRef) {\n return queryRef[QUERY_REFERENCE_SYMBOL];\n}\nexport function updateWrappedQueryRef(queryRef, promise) {\n queryRef[PROMISE_SYMBOL] = promise;\n}\nvar OBSERVED_CHANGED_OPTIONS = [\n \"canonizeResults\",\n \"context\",\n \"errorPolicy\",\n \"fetchPolicy\",\n \"refetchWritePolicy\",\n \"returnPartialData\",\n];\nvar InternalQueryReference = /** @class */ (function () {\n function InternalQueryReference(observable, options) {\n var _this = this;\n this.key = {};\n this.listeners = new Set();\n this.references = 0;\n this.softReferences = 0;\n this.handleNext = this.handleNext.bind(this);\n this.handleError = this.handleError.bind(this);\n this.dispose = this.dispose.bind(this);\n this.observable = observable;\n if (options.onDispose) {\n this.onDispose = options.onDispose;\n }\n this.setResult();\n this.subscribeToQuery();\n // Start a timer that will automatically dispose of the query if the\n // suspended resource does not use this queryRef in the given time. This\n // helps prevent memory leaks when a component has unmounted before the\n // query has finished loading.\n var startDisposeTimer = function () {\n var _a;\n if (!_this.references) {\n _this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);\n }\n };\n // We wait until the request has settled to ensure we don't dispose of the\n // query ref before the request finishes, otherwise we would leave the\n // promise in a pending state rendering the suspense boundary indefinitely.\n this.promise.then(startDisposeTimer, startDisposeTimer);\n }\n Object.defineProperty(InternalQueryReference.prototype, \"disposed\", {\n get: function () {\n return this.subscription.closed;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(InternalQueryReference.prototype, \"watchQueryOptions\", {\n get: function () {\n return this.observable.options;\n },\n enumerable: false,\n configurable: true\n });\n InternalQueryReference.prototype.reinitialize = function () {\n var observable = this.observable;\n var originalFetchPolicy = this.watchQueryOptions.fetchPolicy;\n var avoidNetworkRequests = originalFetchPolicy === \"no-cache\" || originalFetchPolicy === \"standby\";\n try {\n if (avoidNetworkRequests) {\n observable.silentSetOptions({ fetchPolicy: \"standby\" });\n }\n else {\n observable.resetLastResults();\n observable.silentSetOptions({ fetchPolicy: \"cache-first\" });\n }\n this.subscribeToQuery();\n if (avoidNetworkRequests) {\n return;\n }\n observable.resetDiff();\n this.setResult();\n }\n finally {\n observable.silentSetOptions({ fetchPolicy: originalFetchPolicy });\n }\n };\n InternalQueryReference.prototype.retain = function () {\n var _this = this;\n this.references++;\n clearTimeout(this.autoDisposeTimeoutId);\n var disposed = false;\n return function () {\n if (disposed) {\n return;\n }\n disposed = true;\n _this.references--;\n setTimeout(function () {\n if (!_this.references) {\n _this.dispose();\n }\n });\n };\n };\n InternalQueryReference.prototype.softRetain = function () {\n var _this = this;\n this.softReferences++;\n var disposed = false;\n return function () {\n // Tracking if this has already been called helps ensure that\n // multiple calls to this function won't decrement the reference\n // counter more than it should. Subsequent calls just result in a noop.\n if (disposed) {\n return;\n }\n disposed = true;\n _this.softReferences--;\n setTimeout(function () {\n if (!_this.softReferences && !_this.references) {\n _this.dispose();\n }\n });\n };\n };\n InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) {\n var _this = this;\n return OBSERVED_CHANGED_OPTIONS.some(function (option) {\n return option in watchQueryOptions &&\n !equal(_this.watchQueryOptions[option], watchQueryOptions[option]);\n });\n };\n InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) {\n var _a = this.watchQueryOptions, currentFetchPolicy = _a.fetchPolicy, currentCanonizeResults = _a.canonizeResults;\n // \"standby\" is used when `skip` is set to `true`. Detect when we've\n // enabled the query (i.e. `skip` is `false`) to execute a network request.\n if (currentFetchPolicy === \"standby\" &&\n currentFetchPolicy !== watchQueryOptions.fetchPolicy) {\n this.initiateFetch(this.observable.reobserve(watchQueryOptions));\n }\n else {\n this.observable.silentSetOptions(watchQueryOptions);\n if (currentCanonizeResults !== watchQueryOptions.canonizeResults) {\n this.result = __assign(__assign({}, this.result), this.observable.getCurrentResult());\n this.promise = createFulfilledPromise(this.result);\n }\n }\n return this.promise;\n };\n InternalQueryReference.prototype.listen = function (listener) {\n var _this = this;\n this.listeners.add(listener);\n return function () {\n _this.listeners.delete(listener);\n };\n };\n InternalQueryReference.prototype.refetch = function (variables) {\n return this.initiateFetch(this.observable.refetch(variables));\n };\n InternalQueryReference.prototype.fetchMore = function (options) {\n return this.initiateFetch(this.observable.fetchMore(options));\n };\n InternalQueryReference.prototype.dispose = function () {\n this.subscription.unsubscribe();\n this.onDispose();\n };\n InternalQueryReference.prototype.onDispose = function () {\n // noop. overridable by options\n };\n InternalQueryReference.prototype.handleNext = function (result) {\n var _a;\n switch (this.promise.status) {\n case \"pending\": {\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.result = result;\n (_a = this.resolve) === null || _a === void 0 ? void 0 : _a.call(this, result);\n break;\n }\n default: {\n // This occurs when switching to a result that is fully cached when this\n // class is instantiated. ObservableQuery will run reobserve when\n // subscribing, which delivers a result from the cache.\n if (result.data === this.result.data &&\n result.networkStatus === this.result.networkStatus) {\n return;\n }\n // Maintain the last successful `data` value if the next result does not\n // have one.\n if (result.data === void 0) {\n result.data = this.result.data;\n }\n this.result = result;\n this.promise = createFulfilledPromise(result);\n this.deliver(this.promise);\n break;\n }\n }\n };\n InternalQueryReference.prototype.handleError = function (error) {\n var _a;\n this.subscription.unsubscribe();\n this.subscription = this.observable.resubscribeAfterError(this.handleNext, this.handleError);\n switch (this.promise.status) {\n case \"pending\": {\n (_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this, error);\n break;\n }\n default: {\n this.promise = createRejectedPromise(error);\n this.deliver(this.promise);\n }\n }\n };\n InternalQueryReference.prototype.deliver = function (promise) {\n this.listeners.forEach(function (listener) { return listener(promise); });\n };\n InternalQueryReference.prototype.initiateFetch = function (returnedPromise) {\n var _this = this;\n this.promise = this.createPendingPromise();\n this.promise.catch(function () { });\n // If the data returned from the fetch is deeply equal to the data already\n // in the cache, `handleNext` will not be triggered leaving the promise we\n // created in a pending state forever. To avoid this situtation, we attempt\n // to resolve the promise if `handleNext` hasn't been run to ensure the\n // promise is resolved correctly.\n returnedPromise\n .then(function () {\n // In the case of `fetchMore`, this promise is resolved before a cache\n // result is emitted due to the fact that `fetchMore` sets a `no-cache`\n // fetch policy and runs `cache.batch` in its `.then` handler. Because\n // the timing is different, we accidentally run this update twice\n // causing an additional re-render with the `fetchMore` result by\n // itself. By wrapping in `setTimeout`, this should provide a short\n // delay to allow the `QueryInfo.notify` handler to run before this\n // promise is checked.\n // See https://github.com/apollographql/apollo-client/issues/11315 for\n // more information\n setTimeout(function () {\n var _a;\n if (_this.promise.status === \"pending\") {\n // Use the current result from the observable instead of the value\n // resolved from the promise. This avoids issues in some cases where\n // the raw resolved value should not be the emitted value, such as\n // when a `fetchMore` call returns an empty array after it has\n // reached the end of the list.\n //\n // See the following for more information:\n // https://github.com/apollographql/apollo-client/issues/11642\n _this.result = _this.observable.getCurrentResult();\n (_a = _this.resolve) === null || _a === void 0 ? void 0 : _a.call(_this, _this.result);\n }\n });\n })\n .catch(function () { });\n return returnedPromise;\n };\n InternalQueryReference.prototype.subscribeToQuery = function () {\n var _this = this;\n this.subscription = this.observable\n .filter(function (result) { return !equal(result.data, {}) && !equal(result, _this.result); })\n .subscribe(this.handleNext, this.handleError);\n };\n InternalQueryReference.prototype.setResult = function () {\n // Don't save this result as last result to prevent delivery of last result\n // when first subscribing\n var result = this.observable.getCurrentResult(false);\n if (equal(result, this.result)) {\n return;\n }\n this.result = result;\n this.promise =\n (result.data &&\n (!result.partial || this.watchQueryOptions.returnPartialData)) ?\n createFulfilledPromise(result)\n : this.createPendingPromise();\n };\n InternalQueryReference.prototype.createPendingPromise = function () {\n var _this = this;\n return wrapPromiseWithState(new Promise(function (resolve, reject) {\n _this.resolve = resolve;\n _this.reject = reject;\n }));\n };\n return InternalQueryReference;\n}());\nexport { InternalQueryReference };\n//# sourceMappingURL=QueryReference.js.map","import { Trie } from \"@wry/trie\";\nimport { canUseWeakMap } from \"../../../utilities/index.js\";\nimport { InternalQueryReference } from \"./QueryReference.js\";\nvar SuspenseCache = /** @class */ (function () {\n function SuspenseCache(options) {\n if (options === void 0) { options = Object.create(null); }\n this.queryRefs = new Trie(canUseWeakMap);\n this.options = options;\n }\n SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) {\n var ref = this.queryRefs.lookupArray(cacheKey);\n if (!ref.current) {\n ref.current = new InternalQueryReference(createObservable(), {\n autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,\n onDispose: function () {\n delete ref.current;\n },\n });\n }\n return ref.current;\n };\n SuspenseCache.prototype.add = function (cacheKey, queryRef) {\n var ref = this.queryRefs.lookupArray(cacheKey);\n ref.current = queryRef;\n };\n return SuspenseCache;\n}());\nexport { SuspenseCache };\n//# sourceMappingURL=SuspenseCache.js.map","import { SuspenseCache } from \"./SuspenseCache.js\";\nvar suspenseCacheSymbol = Symbol.for(\"apollo.suspenseCache\");\nexport function getSuspenseCache(client) {\n var _a;\n if (!client[suspenseCacheSymbol]) {\n client[suspenseCacheSymbol] = new SuspenseCache((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense);\n }\n return client[suspenseCacheSymbol];\n}\n//# sourceMappingURL=getSuspenseCache.js.map"],"names":["originalInvariant","global","equal","__assign","createFulfilledPromise","createRejectedPromise","wrapPromiseWithState","Trie","canUseWeakMap"],"mappings":";;;;;;;;;;AAAO,IAAI,OAAO,GAAG,QAAQ;;ACAtB,SAAS,KAAK,CAAC,KAAK,EAAE;AAC7B,IAAI,IAAI;AACR,QAAQ,OAAO,KAAK,EAAE,CAAC;AACvB,KAAK;AACL,IAAI,OAAO,EAAE,EAAE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B,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AACtD,SAAS,gBAAgB,CAAC,MAAM,EAAE;AACzC,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE;AACtC,QAAQ,MAAM,CAAC,mBAAmB,CAAC,GAAG,IAAI,aAAa,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;AAC7I,KAAK;AACL,IAAI,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACvC;;;;;;;;;;"}
|
package/react/types/types.d.ts
CHANGED
|
@@ -618,7 +618,7 @@ export interface MutationResult<TData = any> {
|
|
|
618
618
|
/**
|
|
619
619
|
* A function that you can call to reset the mutation's result to its initial, uncalled state.
|
|
620
620
|
*/
|
|
621
|
-
reset()
|
|
621
|
+
reset: () => void;
|
|
622
622
|
}
|
|
623
623
|
export declare type MutationFunction<TData = any, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>> = (options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>) => Promise<FetchResult<TData>>;
|
|
624
624
|
export interface MutationHookOptions<TData = any, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {
|