@apollo/client 4.3.3 → 4.3.5
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 +30 -0
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +4 -1
- package/__cjs/cache/core/types/Cache.d.cts +5 -0
- package/__cjs/cache/inmemory/entityStore.cjs +4 -4
- package/__cjs/cache/inmemory/helpers.cjs +5 -0
- package/__cjs/cache/inmemory/helpers.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs +17 -6
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +3 -1
- package/__cjs/cache/inmemory/key-extractor.cjs +15 -3
- package/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.cjs +21 -5
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.d.cts +2 -0
- package/__cjs/cache/inmemory/readFromStore.cjs +28 -10
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/types.d.cts +7 -2
- package/__cjs/cache/inmemory/writeToStore.cjs +32 -16
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.d.cts +5 -2
- package/__cjs/core/ApolloClient.cjs +14 -14
- package/__cjs/core/ObservableQuery.cjs +8 -8
- package/__cjs/core/QueryInfo.cjs +22 -33
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +1 -1
- package/__cjs/core/QueryManager.cjs +22 -15
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/RefetchEventManager.cjs +3 -3
- package/__cjs/incremental/handlers/defer20220824.cjs +15 -2
- package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
- package/__cjs/incremental/handlers/defer20220824.d.cts +5 -1
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs +58 -14
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs.map +1 -1
- package/__cjs/incremental/handlers/graphql17Alpha9.d.cts +23 -12
- package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
- package/__cjs/incremental/types.d.cts +19 -1
- package/__cjs/invariantErrorCodes.cjs +64 -58
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.d.cts +42 -43
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +0 -1
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.d.ts +4 -1
- package/cache/core/cache.js +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +5 -0
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/inmemory/entityStore.js +4 -4
- package/cache/inmemory/helpers.js +5 -0
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +3 -1
- package/cache/inmemory/inMemoryCache.js +17 -6
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +15 -3
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/policies.d.ts +2 -0
- package/cache/inmemory/policies.js +22 -6
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +28 -10
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +7 -2
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +5 -2
- package/cache/inmemory/writeToStore.js +33 -17
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.js +14 -14
- package/core/ObservableQuery.js +8 -8
- package/core/QueryInfo.d.ts +1 -1
- package/core/QueryInfo.js +23 -34
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +22 -15
- package/core/QueryManager.js.map +1 -1
- package/core/RefetchEventManager.js +3 -3
- package/incremental/handlers/defer20220824.d.ts +5 -1
- package/incremental/handlers/defer20220824.js +15 -2
- package/incremental/handlers/defer20220824.js.map +1 -1
- package/incremental/handlers/graphql17Alpha9.d.ts +23 -12
- package/incremental/handlers/graphql17Alpha9.js +58 -14
- package/incremental/handlers/graphql17Alpha9.js.map +1 -1
- package/incremental/handlers/notImplemented.js +1 -1
- package/incremental/types.d.ts +19 -1
- package/incremental/types.js.map +1 -1
- package/invariantErrorCodes.js +64 -58
- package/package.json +1 -1
- package/react/hooks/useFragment.d.ts +42 -43
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks-compiled/useFragment.d.ts +42 -43
- package/react/hooks-compiled/useFragment.js.map +1 -1
- package/utilities/internal/index.d.ts +0 -1
- package/utilities/internal/index.js.map +1 -1
- package/version.js +1 -1
- package/__cjs/utilities/internal/types/DeferInfo.cjs +0 -3
- package/__cjs/utilities/internal/types/DeferInfo.cjs.map +0 -1
- package/__cjs/utilities/internal/types/DeferInfo.d.cts +0 -10
- package/utilities/internal/types/DeferInfo.d.ts +0 -10
- package/utilities/internal/types/DeferInfo.js +0 -2
- package/utilities/internal/types/DeferInfo.js.map +0 -1
|
@@ -1,53 +1,52 @@
|
|
|
1
1
|
import type { ApolloClient, DataValue, DocumentNode, GetDataState, OperationVariables, TypedDocumentNode } from "@apollo/client";
|
|
2
2
|
import type { ApolloCache, MissingTree } from "@apollo/client/cache";
|
|
3
3
|
import type { MaybeMasked } from "@apollo/client/masking";
|
|
4
|
+
import type { DocumentationTypes as UtilityDocumentationTypes, VariablesOption } from "@apollo/client/utilities/internal";
|
|
4
5
|
export declare namespace useFragment {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* @docGroup 1. Operation options
|
|
45
|
-
*/
|
|
46
|
-
client?: ApolloClient;
|
|
6
|
+
namespace Base {
|
|
7
|
+
interface Options<TData, TVariables extends OperationVariables> {
|
|
8
|
+
/**
|
|
9
|
+
* A GraphQL document created using the `gql` template string tag from
|
|
10
|
+
* `graphql-tag` with one or more fragments which will be used to determine
|
|
11
|
+
* the shape of data to read. If you provide more than one fragment in this
|
|
12
|
+
* document then you must also specify `fragmentName` to select a single.
|
|
13
|
+
*/
|
|
14
|
+
fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
|
15
|
+
/**
|
|
16
|
+
* The name of the fragment in your GraphQL document to be used. If you do
|
|
17
|
+
* not provide a `fragmentName` and there is only one fragment in your
|
|
18
|
+
* `fragment` document then that fragment will be used.
|
|
19
|
+
*/
|
|
20
|
+
fragmentName?: string;
|
|
21
|
+
/**
|
|
22
|
+
* An object or array containing a `__typename` and primary key fields
|
|
23
|
+
* (such as `id`) identifying the entity object from which the fragment will
|
|
24
|
+
* be retrieved, or a `{ __ref: "..." }` reference, or a `string` ID (uncommon).
|
|
25
|
+
*/
|
|
26
|
+
from: useFragment.FromOptionValue<TData> | Array<useFragment.FromOptionValue<TData> | null> | null;
|
|
27
|
+
/**
|
|
28
|
+
* Whether to read from optimistic or non-optimistic cache data. If
|
|
29
|
+
* this named option is provided, the optimistic parameter of the
|
|
30
|
+
* readQuery method can be omitted.
|
|
31
|
+
*
|
|
32
|
+
* @defaultValue true
|
|
33
|
+
*/
|
|
34
|
+
optimistic?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The instance of `ApolloClient` to use to look up the fragment.
|
|
37
|
+
*
|
|
38
|
+
* By default, the instance that's passed down via context is used, but you
|
|
39
|
+
* can provide a different instance here.
|
|
40
|
+
*
|
|
41
|
+
* @docGroup 1. Operation options
|
|
42
|
+
*/
|
|
43
|
+
client?: ApolloClient;
|
|
44
|
+
}
|
|
47
45
|
}
|
|
46
|
+
type Options<TData, TVariables extends OperationVariables> = Base.Options<TData, TVariables> & VariablesOption<NoInfer<TVariables>>;
|
|
48
47
|
namespace DocumentationTypes {
|
|
49
48
|
namespace useFragment {
|
|
50
|
-
interface Options<TData = unknown, TVariables extends OperationVariables = OperationVariables> extends
|
|
49
|
+
interface Options<TData = unknown, TVariables extends OperationVariables = OperationVariables> extends Base.Options<TData, TVariables>, UtilityDocumentationTypes.VariableOptions<TVariables> {
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFragment.js","sources":["../../../src/react/hooks/useFragment.ts"],"sourcesContent":["import * as React from \"react\";\n\nimport type {\n ApolloClient,\n DataValue,\n DocumentNode,\n GetDataState,\n OperationVariables,\n TypedDocumentNode,\n} from \"@apollo/client\";\nimport type { ApolloCache, MissingTree } from \"@apollo/client/cache\";\nimport type { MaybeMasked } from \"@apollo/client/masking\";\n\nimport { useDeepMemo, wrapHook } from \"./internal/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\n\nexport declare namespace useFragment {\n import _self = useFragment;\n\n export interface Options<TData, TVariables extends OperationVariables> {\n /**\n * A GraphQL document created using the `gql` template string tag from\n * `graphql-tag` with one or more fragments which will be used to determine\n * the shape of data to read. If you provide more than one fragment in this\n * document then you must also specify `fragmentName` to select a single.\n */\n fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * The name of the fragment in your GraphQL document to be used. If you do\n * not provide a `fragmentName` and there is only one fragment in your\n * `fragment` document then that fragment will be used.\n */\n fragmentName?: string;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: NoInfer<TVariables>;\n\n /**\n * An object or array containing a `__typename` and primary key fields\n * (such as `id`) identifying the entity object from which the fragment will\n * be retrieved, or a `{ __ref: \"...\" }` reference, or a `string` ID (uncommon).\n */\n from:\n | useFragment.FromOptionValue<TData>\n | Array<useFragment.FromOptionValue<TData> | null>\n | null;\n\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted.\n *\n * @defaultValue true\n */\n optimistic?: boolean;\n\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;\n }\n\n namespace DocumentationTypes {\n namespace useFragment {\n export interface Options<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > extends _self.Options<TData, TVariables> {}\n }\n }\n\n /**\n * Acceptable values provided to the `from` option.\n */\n export type FromOptionValue<TData> = ApolloCache.FromOptionValue<TData>;\n\n // TODO: Update this to return `null` when there is no data returned from the\n // fragment.\n export type Result<TData> =\n | ({\n /** {@inheritDoc @apollo/client/react!useFragment.DocumentationTypes.useFragment.Result#complete:member} */\n complete: true;\n /** {@inheritDoc @apollo/client/react!useFragment.DocumentationTypes.useFragment.Result#missing:member} */\n missing?: never;\n } & GetDataState<MaybeMasked<TData>, \"complete\">)\n | {\n /** {@inheritDoc @apollo/client/react!useFragment.DocumentationTypes.useFragment.Result#complete:member} */\n complete: false;\n /** {@inheritDoc @apollo/client/react!useFragment.DocumentationTypes.useFragment.Result#missing:member} */\n missing?: MissingTree;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: TData extends Array<infer TItem> ?\n Array<DataValue.Partial<TItem> | null>\n : DataValue.Partial<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"partial\";\n };\n\n export namespace DocumentationTypes {\n namespace useFragment {\n export interface Result<TData> {\n data: MaybeMasked<TData> | DataValue.Partial<MaybeMasked<TData>>;\n complete: boolean;\n /**\n * A tree of all `MissingFieldError` messages reported during fragment reading, where the branches of the tree indicate the paths of the errors within the query result.\n */\n missing?: MissingTree;\n }\n }\n }\n export namespace DocumentationTypes {\n /** {@inheritDoc @apollo/client/react!useFragment:function(1)} */\n export function useFragment<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >({\n fragment,\n from,\n fragmentName,\n variables,\n optimistic,\n client,\n }: useFragment.Options<TData, TVariables>): useFragment.Result<TData>;\n }\n}\n\n/**\n * `useFragment` represents a lightweight live binding into the Apollo Client Cache and enables Apollo Client to broadcast very specific fragment results to individual components. This hook returns an always-up-to-date view of whatever data the cache currently contains for a given fragment. `useFragment` never triggers network requests of its own.\n *\n * Note that the `useQuery` hook remains the primary hook responsible for querying and populating data in the cache ([see the API reference](./hooks#usequery)). As a result, the component reading the fragment data via `useFragment` is still subscribed to all changes in the query data, but receives updates only when that fragment's specific data change.\n *\n * To view a `useFragment` example, see the [Fragments](https://www.apollographql.com/docs/react/data/fragments#usefragment) page.\n */\nexport function useFragment<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n options: useFragment.Options<TData, TVariables> & {\n from: Array<useFragment.FromOptionValue<TData>>;\n }\n): useFragment.Result<Array<TData>>;\n\n/** {@inheritDoc @apollo/client/react!useFragment:function(1)} */\nexport function useFragment<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n options: useFragment.Options<TData, TVariables> & {\n from: Array<null>;\n }\n): useFragment.Result<Array<null>>;\n\n/** {@inheritDoc @apollo/client/react!useFragment:function(1)} */\nexport function useFragment<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n options: useFragment.Options<TData, TVariables> & {\n from: Array<useFragment.FromOptionValue<TData> | null>;\n }\n): useFragment.Result<Array<TData | null>>;\n\n/** {@inheritDoc @apollo/client/react!useFragment:function(1)} */\nexport function useFragment<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(options: useFragment.Options<TData, TVariables>): useFragment.Result<TData>;\n\nexport function useFragment<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n options: useFragment.Options<TData, TVariables>\n): useFragment.Result<TData> | useFragment.Result<Array<TData | null>> {\n \"use no memo\";\n return wrapHook(\n \"useFragment\",\n useFragment_,\n useApolloClient(options.client)\n )(options);\n}\n\nfunction useFragment_<TData, TVariables extends OperationVariables>(\n options: useFragment.Options<TData, TVariables>\n): useFragment.Result<TData> | useFragment.Result<Array<TData | null>> {\n const client = useApolloClient(options.client);\n const { from, ...rest } = options;\n const { cache } = client;\n\n // We calculate the cache id seperately because we don't want changes to non\n // key fields in the `from` property to recreate the observable. If the cache\n // identifier stays the same between renders, we want to reuse the existing\n // subscription.\n const ids = useDeepMemo(() => {\n const fromArray = Array.isArray(from) ? from : [from];\n\n const ids = fromArray.map((value) =>\n typeof value === \"string\" ? value\n : value === null ? null\n : cache.identify(value)\n );\n\n return Array.isArray(from) ? ids : ids[0];\n }, [cache, from]);\n\n const stableOptions = useDeepMemo(\n () => ({ ...rest, from: ids as any }),\n [rest, ids]\n );\n\n const observable = React.useMemo(\n () => client.watchFragment(stableOptions),\n [client, stableOptions]\n );\n\n // Unfortunately we forgot to update the use case of `from: null` on\n // useFragment in 4.0 to match `useSuspenseFragment`. As such, we need to\n // fallback to data: {} with complete: false when `from` is `null` to maintain\n // backwards compatibility. We should plan to change this in v5.\n const getSnapshot = React.useCallback(\n () => (from === null ? nullResult : observable.getCurrentResult()),\n [from, observable]\n );\n\n return useSyncExternalStore(\n React.useCallback(\n (update) => {\n let lastTimeout = 0;\n const subscription = observable.subscribe({\n next: () => {\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(update) as any;\n },\n });\n\n return () => {\n subscription.unsubscribe();\n clearTimeout(lastTimeout);\n };\n },\n [observable]\n ),\n getSnapshot,\n getSnapshot\n );\n}\n\nconst nullResult = Object.freeze({\n data: {},\n dataState: \"partial\",\n complete: false,\n}) as useFragment.Result<any>;\n"],"names":[],"mappings":";AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAP,CAAA,EAAY,CAAZ,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAuB,CAAvB,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B;AAa9B,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB,EAAE,CAAtB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAsC,CAAtC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA2D;AAC3D,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAgC,CAAhC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsD;AACtD,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAA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A,CAAyB,CAAC,CAA1B,CAAA,CAAA,CAAA,CAAA,CAAgC,CAAC;IAC/B,CAAF,CAAA,CAAA,CAAM,EAAE,CAAR,CAAU;IACR,CAAF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,EAAE,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsB;IACpB,CAAF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,EAAE,CAAZ,CAAA,CAAA,CAAA,CAAiB;AACjB,CAAC;"}
|
|
1
|
+
{"version":3,"file":"useFragment.js","sources":["../../../src/react/hooks/useFragment.ts"],"sourcesContent":["import * as React from \"react\";\n\nimport type {\n ApolloClient,\n DataValue,\n DocumentNode,\n GetDataState,\n OperationVariables,\n TypedDocumentNode,\n} from \"@apollo/client\";\nimport type { ApolloCache, MissingTree } from \"@apollo/client/cache\";\nimport type { MaybeMasked } from \"@apollo/client/masking\";\nimport type {\n DocumentationTypes as UtilityDocumentationTypes,\n VariablesOption,\n} from \"@apollo/client/utilities/internal\";\n\nimport { useDeepMemo, wrapHook } from \"./internal/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\n\nexport declare namespace useFragment {\n export namespace Base {\n export interface Options<TData, TVariables extends OperationVariables> {\n /**\n * A GraphQL document created using the `gql` template string tag from\n * `graphql-tag` with one or more fragments which will be used to determine\n * the shape of data to read. If you provide more than one fragment in this\n * document then you must also specify `fragmentName` to select a single.\n */\n fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * The name of the fragment in your GraphQL document to be used. If you do\n * not provide a `fragmentName` and there is only one fragment in your\n * `fragment` document then that fragment will be used.\n */\n fragmentName?: string;\n\n /**\n * An object or array containing a `__typename` and primary key fields\n * (such as `id`) identifying the entity object from which the fragment will\n * be retrieved, or a `{ __ref: \"...\" }` reference, or a `string` ID (uncommon).\n */\n from:\n | useFragment.FromOptionValue<TData>\n | Array<useFragment.FromOptionValue<TData> | null>\n | null;\n\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted.\n *\n * @defaultValue true\n */\n optimistic?: boolean;\n\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;\n }\n }\n\n export type Options<\n TData,\n TVariables extends OperationVariables,\n > = Base.Options<TData, TVariables> & VariablesOption<NoInfer<TVariables>>;\n\n namespace DocumentationTypes {\n namespace useFragment {\n export interface Options<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n > extends Base.Options<TData, TVariables>,\n UtilityDocumentationTypes.VariableOptions<TVariables> {}\n }\n }\n\n /**\n * Acceptable values provided to the `from` option.\n */\n export type FromOptionValue<TData> = ApolloCache.FromOptionValue<TData>;\n\n // TODO: Update this to return `null` when there is no data returned from the\n // fragment.\n export type Result<TData> =\n | ({\n /** {@inheritDoc @apollo/client/react!useFragment.DocumentationTypes.useFragment.Result#complete:member} */\n complete: true;\n /** {@inheritDoc @apollo/client/react!useFragment.DocumentationTypes.useFragment.Result#missing:member} */\n missing?: never;\n } & GetDataState<MaybeMasked<TData>, \"complete\">)\n | {\n /** {@inheritDoc @apollo/client/react!useFragment.DocumentationTypes.useFragment.Result#complete:member} */\n complete: false;\n /** {@inheritDoc @apollo/client/react!useFragment.DocumentationTypes.useFragment.Result#missing:member} */\n missing?: MissingTree;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#data:member} */\n data: TData extends Array<infer TItem> ?\n Array<DataValue.Partial<TItem> | null>\n : DataValue.Partial<TData>;\n /** {@inheritDoc @apollo/client!QueryResultDocumentation#dataState:member} */\n dataState: \"partial\";\n };\n\n export namespace DocumentationTypes {\n namespace useFragment {\n export interface Result<TData> {\n data: MaybeMasked<TData> | DataValue.Partial<MaybeMasked<TData>>;\n complete: boolean;\n /**\n * A tree of all `MissingFieldError` messages reported during fragment reading, where the branches of the tree indicate the paths of the errors within the query result.\n */\n missing?: MissingTree;\n }\n }\n }\n export namespace DocumentationTypes {\n /** {@inheritDoc @apollo/client/react!useFragment:function(1)} */\n export function useFragment<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >({\n fragment,\n from,\n fragmentName,\n variables,\n optimistic,\n client,\n }: useFragment.Options<TData, TVariables>): useFragment.Result<TData>;\n }\n}\n\n/**\n * `useFragment` represents a lightweight live binding into the Apollo Client Cache and enables Apollo Client to broadcast very specific fragment results to individual components. This hook returns an always-up-to-date view of whatever data the cache currently contains for a given fragment. `useFragment` never triggers network requests of its own.\n *\n * Note that the `useQuery` hook remains the primary hook responsible for querying and populating data in the cache ([see the API reference](./hooks#usequery)). As a result, the component reading the fragment data via `useFragment` is still subscribed to all changes in the query data, but receives updates only when that fragment's specific data change.\n *\n * To view a `useFragment` example, see the [Fragments](https://www.apollographql.com/docs/react/data/fragments#usefragment) page.\n */\nexport function useFragment<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n options: useFragment.Options<TData, TVariables> & {\n from: Array<useFragment.FromOptionValue<TData>>;\n }\n): useFragment.Result<Array<TData>>;\n\n/** {@inheritDoc @apollo/client/react!useFragment:function(1)} */\nexport function useFragment<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n options: useFragment.Options<TData, TVariables> & {\n from: Array<null>;\n }\n): useFragment.Result<Array<null>>;\n\n/** {@inheritDoc @apollo/client/react!useFragment:function(1)} */\nexport function useFragment<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n options: useFragment.Options<TData, TVariables> & {\n from: Array<useFragment.FromOptionValue<TData> | null>;\n }\n): useFragment.Result<Array<TData | null>>;\n\n/** {@inheritDoc @apollo/client/react!useFragment:function(1)} */\nexport function useFragment<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(options: useFragment.Options<TData, TVariables>): useFragment.Result<TData>;\n\nexport function useFragment<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n>(\n options: useFragment.Options<TData, TVariables>\n): useFragment.Result<TData> | useFragment.Result<Array<TData | null>> {\n \"use no memo\";\n return wrapHook(\n \"useFragment\",\n useFragment_,\n useApolloClient(options.client)\n )(options);\n}\n\nfunction useFragment_<TData, TVariables extends OperationVariables>(\n options: useFragment.Options<TData, TVariables>\n): useFragment.Result<TData> | useFragment.Result<Array<TData | null>> {\n const client = useApolloClient(options.client);\n const { from, ...rest } = options;\n const { cache } = client;\n\n // We calculate the cache id seperately because we don't want changes to non\n // key fields in the `from` property to recreate the observable. If the cache\n // identifier stays the same between renders, we want to reuse the existing\n // subscription.\n const ids = useDeepMemo(() => {\n const fromArray = Array.isArray(from) ? from : [from];\n\n const ids = fromArray.map((value) =>\n typeof value === \"string\" ? value\n : value === null ? null\n : cache.identify(value)\n );\n\n return Array.isArray(from) ? ids : ids[0];\n }, [cache, from]);\n\n const stableOptions = useDeepMemo(\n () => ({ ...rest, from: ids as any }),\n [rest, ids]\n );\n\n const observable = React.useMemo(\n () => client.watchFragment(stableOptions),\n [client, stableOptions]\n );\n\n // Unfortunately we forgot to update the use case of `from: null` on\n // useFragment in 4.0 to match `useSuspenseFragment`. As such, we need to\n // fallback to data: {} with complete: false when `from` is `null` to maintain\n // backwards compatibility. We should plan to change this in v5.\n const getSnapshot = React.useCallback(\n () => (from === null ? nullResult : observable.getCurrentResult()),\n [from, observable]\n );\n\n return useSyncExternalStore(\n React.useCallback(\n (update) => {\n let lastTimeout = 0;\n const subscription = observable.subscribe({\n next: () => {\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(update) as any;\n },\n });\n\n return () => {\n subscription.unsubscribe();\n clearTimeout(lastTimeout);\n };\n },\n [observable]\n ),\n getSnapshot,\n getSn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A,CAAA,CAAW,EAAE,CAAb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsB;IACpB,CAAF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,EAAE,CAAZ,CAAA,CAAA,CAAA,CAAiB;AACjB,CAAC;"}
|
|
@@ -14,7 +14,6 @@ export type { Primitive } from "./types/Primitive.js";
|
|
|
14
14
|
export type { RejectedPromise } from "./types/RejectedPromise.js";
|
|
15
15
|
export type { RemoveIndexSignature } from "./types/RemoveIndexSignature.js";
|
|
16
16
|
export type { StreamInfoTrie } from "./types/StreamInfoTrie.js";
|
|
17
|
-
export type { DeferInfoTrie } from "./types/DeferInfo.js";
|
|
18
17
|
export type { VariablesOption } from "./types/VariablesOption.js";
|
|
19
18
|
export type { DocumentationTypes } from "./types/DocumentationTypes.js";
|
|
20
19
|
export type { LazyType } from "./LazyType.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/internal/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utilities/internal/index.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE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C/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B,+BAA+B,EAC/B,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export type { DecoratedPromise } from \"./types/DecoratedPromise.js\";\nexport type { DeepOmit } from \"./types/DeepOmit.js\";\nexport type { Exact } from \"./types/Exact.js\";\nexport type { ExtensionsWithStreamInfo } from \"./types/ExtensionsWithStreamDetails.js\";\nexport type { FragmentMap } from \"./types/FragmentMap.js\";\nexport type { FragmentMapFunction } from \"./types/FragmentMapFunction.js\";\nexport type { FulfilledPromise } from \"./types/FulfilledPromise.js\";\nexport type { IsAny } from \"./types/IsAny.js\";\nexport type { IsLooselyEqual } from \"./types/IsLooselyEqual.js\";\nexport type { IsNeverish } from \"./types/IsNeverish.js\";\nexport type { PendingPromise } from \"./types/PendingPromise.js\";\nexport type { Prettify } from \"./types/Prettify.js\";\nexport type { Primitive } from \"./types/Primitive.js\";\nexport type { RejectedPromise } from \"./types/RejectedPromise.js\";\nexport type { RemoveIndexSignature } from \"./types/RemoveIndexSignature.js\";\nexport type { StreamInfoTrie } from \"./types/StreamInfoTrie.js\";\nexport type { VariablesOption } from \"./types/VariablesOption.js\";\nexport type { DocumentationTypes } from \"./types/DocumentationTypes.js\";\nexport type { LazyType } from \"./LazyType.js\";\nexport type {\n ClassicSignature,\n SignatureStyle,\n} from \"./types/SignatureStyle.js\";\nexport type { OptionWithFallback } from \"./types/OptionWithFallback.js\";\n\nexport { addDeferFragmentLabels } from \"./addDeferFragmentLabels.js\";\nexport { argumentsObjectFromField } from \"./argumentsObjectFromField.js\";\nexport { capitalize } from \"./capitalize.js\";\nexport { canUseDOM } from \"./canUseDOM.js\";\nexport { checkDocument } from \"./checkDocument.js\";\nexport { cloneDeep } from \"./cloneDeep.js\";\nexport { coerceScalarFieldsToParsed } from \"./coerceScalarFieldsToParsed.js\";\nexport { combineLatestBatched } from \"./combineLatestBatched.js\";\nexport { compact } from \"./compact.js\";\nexport { createFragmentMap } from \"./createFragmentMap.js\";\nexport { createFulfilledPromise } from \"./createFulfilledPromise.js\";\nexport { createRejectedPromise } from \"./createRejectedPromise.js\";\nexport { dealias } from \"./dealias.js\";\nexport { decoratePromise } from \"./decoratePromise.js\";\nexport { DeepMerger } from \"./DeepMerger.js\";\nexport { getDefaultValues } from \"./getDefaultValues.js\";\nexport { getDirectiveArgValue } from \"./getDirectiveArgValue.js\";\nexport { getFragmentFromSelection } from \"./getFragmentFromSelection.js\";\nexport { getFragmentQueryDocument } from \"./getFragmentQueryDocument.js\";\nexport { getFragmentDefinition } from \"./getFragmentDefinition.js\";\nexport { getFragmentDefinitions } from \"./getFragmentDefinitions.js\";\nexport { getGraphQLErrorsFromResult } from \"./getGraphQLErrorsFromResult.js\";\nexport { getMainDefinition } from \"./getMainDefinition.js\";\nexport { getOperationDefinition } from \"./getOperationDefinition.js\";\nexport { getOperationName } from \"./getOperationName.js\";\nexport { getQueryDefinition } from \"./getQueryDefinition.js\";\nexport { getStoreKeyName } from \"./getStoreKeyName.js\";\nexport { graphQLResultHasError } from \"./graphQLResultHasError.js\";\nexport { hasDirectives } from \"./hasDirectives.js\";\nexport { hasForcedResolvers } from \"./hasForcedResolvers.js\";\nexport { isArray } from \"./isArray.js\";\nexport { isDeferredFragment } from \"./isDeferredFragment.js\";\nexport { isDocumentNode } from \"./isDocumentNode.js\";\nexport { isField } from \"./isField.js\";\nexport { isNonEmptyArray } from \"./isNonEmptyArray.js\";\nexport { isNonNullObject } from \"./isNonNullObject.js\";\nexport { isPlainObject } from \"./isPlainObject.js\";\nexport { isStreamField } from \"./isStreamField.js\";\nexport { isTypenameField } from \"./isTypenameField.js\";\nexport { makeStreamInfoTrie } from \"./makeStreamInfoTrie.js\";\nexport { makeReference } from \"./makeReference.js\";\nexport { makeUniqueId } from \"./makeUniqueId.js\";\nexport { matchScalarList } from \"./matchScalarList.js\";\nexport { maybeDeepFreeze } from \"./maybeDeepFreeze.js\";\nexport { mergeDeep } from \"./mergeDeep.js\";\nexport { mergeDeepArray } from \"./mergeDeepArray.js\";\nexport { mergeOptions } from \"./mergeOptions.js\";\nexport { omitDeep } from \"./omitDeep.js\";\nexport { preventUnhandledRejection } from \"./preventUnhandledRejection.js\";\nexport { removeDirectivesFromDocument } from \"./removeDirectivesFromDocument.js\";\nexport { removeMaskedFragmentSpreads } from \"./removeFragmentSpreads.js\";\nexport { resultKeyNameFromField } from \"./resultKeyNameFromField.js\";\nexport { shouldInclude } from \"./shouldInclude.js\";\nexport { storeKeyNameFromField } from \"./storeKeyNameFromField.js\";\nexport { StreamArrayState } from \"./StreamArrayState.js\";\nexport { stringifyForDisplay } from \"./stringifyForDisplay.js\";\nexport { toDiffWithDataState } from \"./toDiffWithDataState.js\";\nexport { toQueryResult } from \"./toQueryResult.js\";\nexport { unwrapScalarType } from \"./unwrapScalarType.js\";\nexport { filterMap } from \"./filterMap.js\";\nexport { equalByQuery } from \"./equalByQuery.js\";\nexport { canonicalStringify } from \"./canonicalStringify.js\";\nexport { mapObservableFragmentMemoized } from \"./mapObservableFragment.js\";\nexport {\n extensionsSymbol,\n handleIncrementalSymbol,\n streamInfoSymbol,\n variablesUnknownSymbol,\n} from \"./constants.js\";\nexport { bindCacheKey } from \"./bindCacheKey.js\";\n\nexport {\n getApolloCacheMemoryInternals,\n getApolloClientMemoryInternals,\n getInMemoryCacheMemoryInternals,\n registerGlobalCache,\n} from \"../internal/getMemoryInternals.js\";\n\nexport { AutoCleanedStrongCache, AutoCleanedWeakCache } from \"./caches.js\";\n\nexport type { ApplyHKT } from \"./types/ApplyHKT.js\";\nexport type { ApplyHKTImplementationWithDefault } from \"./types/ApplyHKTImplementationWithDefault.js\";\n"]}
|
package/version.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeferInfo.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Trie } from "@wry/trie";
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
* For use in InMemoryCache only. This should not be used in userland
|
|
5
|
-
* code.
|
|
6
|
-
*
|
|
7
|
-
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
8
|
-
*/
|
|
9
|
-
export type DeferInfoTrie = Trie<true>;
|
|
10
|
-
//# sourceMappingURL=DeferInfo.d.cts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Trie } from "@wry/trie";
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
* For use in InMemoryCache only. This should not be used in userland
|
|
5
|
-
* code.
|
|
6
|
-
*
|
|
7
|
-
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
8
|
-
*/
|
|
9
|
-
export type DeferInfoTrie = Trie<true>;
|
|
10
|
-
//# sourceMappingURL=DeferInfo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeferInfo.js","sourceRoot":"","sources":["../../../../src/utilities/internal/types/DeferInfo.ts"],"names":[],"mappings":"","sourcesContent":["import type { Trie } from \"@wry/trie\";\n\n/**\n * @internal\n * For use in InMemoryCache only. This should not be used in userland\n * code.\n */\nexport type DeferInfoTrie = Trie<true>;\n"]}
|