@apollo/client 4.0.0-rc.2 → 4.0.0-rc.3
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 +19 -0
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/index.cjs.map +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/helpers.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/reactiveVars.cjs.map +1 -1
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/core/ApolloClient.cjs +20 -4
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +17 -2
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/equalByQuery.cjs.map +1 -1
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/networkStatus.cjs.map +1 -1
- package/__cjs/dev/index.cjs.map +1 -1
- package/__cjs/dev/loadDevMessages.cjs.map +1 -1
- package/__cjs/dev/loadErrorMessageHandler.cjs.map +1 -1
- package/__cjs/dev/loadErrorMessages.cjs.map +1 -1
- package/__cjs/dev/setErrorMessageHandler.cjs.map +1 -1
- package/__cjs/dev/symbol.cjs.map +1 -1
- package/__cjs/errors/CombinedGraphQLErrors.cjs.map +1 -1
- package/__cjs/errors/CombinedProtocolErrors.cjs.map +1 -1
- package/__cjs/errors/LinkError.cjs.map +1 -1
- package/__cjs/errors/LocalStateError.cjs.map +1 -1
- package/__cjs/errors/ServerError.cjs.map +1 -1
- package/__cjs/errors/ServerParseError.cjs.map +1 -1
- package/__cjs/errors/UnconventionalError.cjs.map +1 -1
- package/__cjs/errors/index.cjs.map +1 -1
- package/__cjs/errors/isErrorLike.cjs.map +1 -1
- package/__cjs/errors/utils.cjs.map +1 -1
- package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
- package/__cjs/incremental/index.cjs.map +1 -1
- package/__cjs/invariantErrorCodes.cjs.map +1 -1
- package/__cjs/link/batch/batchLink.cjs.map +1 -1
- package/__cjs/link/batch/index.cjs.map +1 -1
- package/__cjs/link/batch-http/batchHttpLink.cjs.map +1 -1
- package/__cjs/link/batch-http/index.cjs.map +1 -1
- package/__cjs/link/client-awareness/index.cjs.map +1 -1
- package/__cjs/link/core/concat.cjs.map +1 -1
- package/__cjs/link/core/empty.cjs.map +1 -1
- package/__cjs/link/core/execute.cjs.map +1 -1
- package/__cjs/link/core/from.cjs.map +1 -1
- package/__cjs/link/core/split.cjs.map +1 -1
- package/__cjs/link/http/BaseHttpLink.cjs.map +1 -1
- package/__cjs/link/http/HttpLink.cjs.map +1 -1
- package/__cjs/link/http/index.cjs.map +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
- package/__cjs/link/http/rewriteURIForGET.cjs.map +1 -1
- package/__cjs/link/http/selectHttpOptionsAndBody.cjs.map +1 -1
- package/__cjs/link/index.cjs.map +1 -1
- package/__cjs/link/remove-typename/index.cjs.map +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
- package/__cjs/link/retry/delayFunction.cjs.map +1 -1
- package/__cjs/link/retry/index.cjs.map +1 -1
- package/__cjs/link/retry/retryFunction.cjs.map +1 -1
- package/__cjs/link/retry/retryLink.cjs.map +1 -1
- package/__cjs/link/utils/createOperation.cjs.map +1 -1
- package/__cjs/link/utils/filterOperationVariables.cjs.map +1 -1
- package/__cjs/link/utils/index.cjs.map +1 -1
- package/__cjs/link/utils/transformOperation.cjs.map +1 -1
- package/__cjs/link/utils/validateOperation.cjs.map +1 -1
- package/__cjs/local-state/LocalState.cjs.map +1 -1
- package/__cjs/local-state/index.cjs.map +1 -1
- package/__cjs/masking/index.cjs.map +1 -1
- package/__cjs/masking/maskDefinition.cjs.map +1 -1
- package/__cjs/masking/maskFragment.cjs.map +1 -1
- package/__cjs/masking/maskOperation.cjs.map +1 -1
- package/__cjs/masking/utils.cjs.map +1 -1
- package/__cjs/react/context/ApolloContext.cjs.map +1 -1
- package/__cjs/react/hooks/constants.cjs.map +1 -1
- package/__cjs/react/hooks/internal/__use.cjs.map +1 -1
- package/__cjs/react/hooks/internal/index.cjs.map +1 -1
- package/__cjs/react/hooks/internal/useDeepMemo.cjs.map +1 -1
- package/__cjs/react/hooks/internal/useIsomorphicLayoutEffect.cjs.map +1 -1
- package/__cjs/react/hooks/internal/useRenderGuard.cjs.map +1 -1
- package/__cjs/react/hooks/internal/validateSuspenseHookOptions.cjs.map +1 -1
- package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
- package/__cjs/react/hooks/useApolloClient.cjs.map +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
- package/__cjs/react/hooks/useReactiveVar.cjs.map +1 -1
- package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSyncExternalStore.cjs.map +1 -1
- package/__cjs/react/index.cjs +2 -1
- package/__cjs/react/index.cjs.map +1 -1
- package/__cjs/react/index.d.cts +1 -0
- package/__cjs/react/index.react-server.cjs.map +1 -1
- package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
- package/__cjs/react/internal/cache/getSuspenseCache.cjs.map +1 -1
- package/__cjs/react/internal/compiler-runtime/index.cjs +32 -0
- package/__cjs/react/internal/compiler-runtime/index.cjs.map +1 -0
- package/__cjs/react/internal/compiler-runtime/index.d.cts +8 -0
- package/__cjs/react/internal/index.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
- package/__cjs/react/ssr/getDataFromTree.cjs.map +1 -1
- package/__cjs/react/ssr/index.cjs.map +1 -1
- package/__cjs/react/ssr/renderToStringWithData.cjs.map +1 -1
- package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
- package/__cjs/testing/index.cjs.map +1 -1
- package/__cjs/testing/react/index.cjs.map +1 -1
- package/__cjs/utilities/caching/index.cjs.map +1 -1
- package/__cjs/utilities/caching/sizes.cjs.map +1 -1
- package/__cjs/utilities/common/stripTypename.cjs.map +1 -1
- package/__cjs/utilities/environment/index.cjs.map +1 -1
- package/__cjs/utilities/environment/index.development.cjs.map +1 -1
- package/__cjs/utilities/environment/index.production.cjs.map +1 -1
- package/__cjs/utilities/graphql/isFormattedExecutionResult.cjs.map +1 -1
- package/__cjs/utilities/graphql/operations.cjs.map +1 -1
- package/__cjs/utilities/graphql/print.cjs.map +1 -1
- package/__cjs/utilities/graphql/storeUtils.cjs.map +1 -1
- package/__cjs/utilities/graphql/transform.cjs.map +1 -1
- package/__cjs/utilities/index.cjs.map +1 -1
- package/__cjs/utilities/internal/argumentsObjectFromField.cjs.map +1 -1
- package/__cjs/utilities/internal/caches.cjs.map +1 -1
- package/__cjs/utilities/internal/canUseDOM.cjs.map +1 -1
- package/__cjs/utilities/internal/checkDocument.cjs.map +1 -1
- package/__cjs/utilities/internal/cloneDeep.cjs.map +1 -1
- package/__cjs/utilities/internal/compact.cjs.map +1 -1
- package/__cjs/utilities/internal/createFragmentMap.cjs.map +1 -1
- package/__cjs/utilities/internal/createFulfilledPromise.cjs.map +1 -1
- package/__cjs/utilities/internal/createRejectedPromise.cjs.map +1 -1
- package/__cjs/utilities/internal/dealias.cjs.map +1 -1
- package/__cjs/utilities/internal/decoratePromise.cjs.map +1 -1
- package/__cjs/utilities/internal/deepFreeze.cjs.map +1 -1
- package/__cjs/utilities/internal/filterMap.cjs.map +1 -1
- package/__cjs/utilities/internal/getDefaultValues.cjs.map +1 -1
- package/__cjs/utilities/internal/getFragmentDefinition.cjs.map +1 -1
- package/__cjs/utilities/internal/getFragmentDefinitions.cjs.map +1 -1
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs.map +1 -1
- package/__cjs/utilities/internal/getFragmentQueryDocument.cjs.map +1 -1
- package/__cjs/utilities/internal/getGraphQLErrorsFromResult.cjs.map +1 -1
- package/__cjs/utilities/internal/getMainDefinition.cjs.map +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
- package/__cjs/utilities/internal/getOperationDefinition.cjs.map +1 -1
- package/__cjs/utilities/internal/getOperationName.cjs.map +1 -1
- package/__cjs/utilities/internal/getQueryDefinition.cjs.map +1 -1
- package/__cjs/utilities/internal/getStoreKeyName.cjs.map +1 -1
- package/__cjs/utilities/internal/globals/global.cjs.map +1 -1
- package/__cjs/utilities/internal/globals/index.cjs.map +1 -1
- package/__cjs/utilities/internal/globals/maybe.cjs.map +1 -1
- package/__cjs/utilities/internal/graphQLResultHasError.cjs.map +1 -1
- package/__cjs/utilities/internal/hasDirectives.cjs.map +1 -1
- package/__cjs/utilities/internal/hasForcedResolvers.cjs.map +1 -1
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.production.cjs.map +1 -1
- package/__cjs/utilities/internal/isArray.cjs.map +1 -1
- package/__cjs/utilities/internal/isDocumentNode.cjs.map +1 -1
- package/__cjs/utilities/internal/isField.cjs.map +1 -1
- package/__cjs/utilities/internal/isNonEmptyArray.cjs.map +1 -1
- package/__cjs/utilities/internal/isNonNullObject.cjs.map +1 -1
- package/__cjs/utilities/internal/isPlainObject.cjs.map +1 -1
- package/__cjs/utilities/internal/makeReference.cjs.map +1 -1
- package/__cjs/utilities/internal/makeUniqueId.cjs.map +1 -1
- package/__cjs/utilities/internal/maybeDeepFreeze.cjs.map +1 -1
- package/__cjs/utilities/internal/mergeDeep.cjs.map +1 -1
- package/__cjs/utilities/internal/mergeDeepArray.cjs.map +1 -1
- package/__cjs/utilities/internal/mergeOptions.cjs.map +1 -1
- package/__cjs/utilities/internal/omitDeep.cjs.map +1 -1
- package/__cjs/utilities/internal/preventUnhandledRejection.cjs.map +1 -1
- package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs.map +1 -1
- package/__cjs/utilities/internal/resultKeyNameFromField.cjs.map +1 -1
- package/__cjs/utilities/internal/shouldInclude.cjs.map +1 -1
- package/__cjs/utilities/internal/storeKeyNameFromField.cjs.map +1 -1
- package/__cjs/utilities/internal/stringifyForDisplay.cjs.map +1 -1
- package/__cjs/utilities/internal/toQueryResult.cjs.map +1 -1
- package/__cjs/utilities/internal/valueToObjectRepresentation.cjs.map +1 -1
- package/__cjs/utilities/invariant/index.cjs.map +1 -1
- package/__cjs/utilities/invariant/index.development.cjs.map +1 -1
- package/__cjs/utilities/policies/pagination.cjs.map +1 -1
- package/__cjs/utilities/shared/canonicalStringify.cjs.map +1 -1
- package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
- package/__cjs/version.cjs +1 -1
- package/__cjs/version.cjs.map +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +1 -1
- package/cache/core/types/Cache.js +1 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +1 -1
- package/cache/core/types/DataProxy.js +1 -1
- package/cache/core/types/DataProxy.js.map +1 -1
- package/cache/core/types/common.d.ts +1 -1
- package/cache/core/types/common.js +1 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/index.d.ts +1 -1
- package/cache/index.js +1 -1
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +1 -1
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.d.ts +1 -1
- package/cache/inmemory/fragmentRegistry.js +1 -1
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +1 -1
- package/cache/inmemory/helpers.js +1 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/key-extractor.d.ts +1 -1
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/policies.d.ts +1 -1
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.d.ts +1 -1
- package/cache/inmemory/reactiveVars.js +1 -1
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +1 -1
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +1 -1
- package/cache/inmemory/types.js +1 -1
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +1 -1
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +17 -2
- package/core/ApolloClient.js +20 -4
- package/core/ApolloClient.js.map +1 -1
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +1 -1
- package/core/QueryManager.js.map +1 -1
- package/core/equalByQuery.d.ts +1 -1
- package/core/equalByQuery.js +1 -1
- package/core/equalByQuery.js.map +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/core/networkStatus.d.ts +1 -1
- package/core/networkStatus.js +1 -1
- package/core/networkStatus.js.map +1 -1
- package/core/types.js +1 -1
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.js +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/index.d.ts +1 -1
- package/dev/index.js +1 -1
- package/dev/index.js.map +1 -1
- package/dev/loadDevMessages.d.ts +1 -1
- package/dev/loadDevMessages.js +1 -1
- package/dev/loadDevMessages.js.map +1 -1
- package/dev/loadErrorMessageHandler.d.ts +1 -1
- package/dev/loadErrorMessageHandler.js +1 -1
- package/dev/loadErrorMessageHandler.js.map +1 -1
- package/dev/loadErrorMessages.d.ts +1 -1
- package/dev/loadErrorMessages.js +1 -1
- package/dev/loadErrorMessages.js.map +1 -1
- package/dev/setErrorMessageHandler.d.ts +1 -1
- package/dev/setErrorMessageHandler.js +1 -1
- package/dev/setErrorMessageHandler.js.map +1 -1
- package/dev/symbol.d.ts +1 -1
- package/dev/symbol.js +1 -1
- package/dev/symbol.js.map +1 -1
- package/errors/CombinedGraphQLErrors.d.ts +1 -1
- package/errors/CombinedGraphQLErrors.js +1 -1
- package/errors/CombinedGraphQLErrors.js.map +1 -1
- package/errors/CombinedProtocolErrors.d.ts +1 -1
- package/errors/CombinedProtocolErrors.js +1 -1
- package/errors/CombinedProtocolErrors.js.map +1 -1
- package/errors/LinkError.js.map +1 -1
- package/errors/LocalStateError.d.ts +1 -1
- package/errors/LocalStateError.js +1 -1
- package/errors/LocalStateError.js.map +1 -1
- package/errors/ServerError.d.ts +1 -1
- package/errors/ServerError.js +1 -1
- package/errors/ServerError.js.map +1 -1
- package/errors/ServerParseError.d.ts +1 -1
- package/errors/ServerParseError.js +1 -1
- package/errors/ServerParseError.js.map +1 -1
- package/errors/UnconventionalError.d.ts +1 -1
- package/errors/UnconventionalError.js +1 -1
- package/errors/UnconventionalError.js.map +1 -1
- package/errors/index.d.ts +1 -1
- package/errors/index.js +1 -1
- package/errors/index.js.map +1 -1
- package/errors/isErrorLike.d.ts +1 -1
- package/errors/isErrorLike.js +1 -1
- package/errors/isErrorLike.js.map +1 -1
- package/errors/utils.d.ts +1 -1
- package/errors/utils.js +1 -1
- package/errors/utils.js.map +1 -1
- package/incremental/handlers/defer20220824.d.ts +1 -1
- package/incremental/handlers/defer20220824.js +1 -1
- package/incremental/handlers/defer20220824.js.map +1 -1
- package/incremental/handlers/notImplemented.d.ts +1 -1
- package/incremental/index.d.ts +1 -1
- package/incremental/index.js.map +1 -1
- package/incremental/types.js +1 -1
- package/incremental/types.js.map +1 -1
- package/invariantErrorCodes.d.ts +1 -1
- package/invariantErrorCodes.js +4 -1
- package/invariantErrorCodes.js.map +1 -1
- package/legacyEntryPoints/react/internal/compiler-runtime/compiler-runtime.cjs +1 -0
- package/legacyEntryPoints/react/internal/compiler-runtime/compiler-runtime.d.cts +1 -0
- package/legacyEntryPoints/react/internal/compiler-runtime/index.d.ts +1 -0
- package/legacyEntryPoints/react/internal/compiler-runtime/index.js +1 -0
- package/link/batch/batchLink.d.ts +1 -1
- package/link/batch/batchLink.js +1 -1
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.d.ts +1 -1
- package/link/batch/batching.js +1 -1
- package/link/batch/batching.js.map +1 -1
- package/link/batch/index.d.ts +1 -1
- package/link/batch/index.js +1 -1
- package/link/batch/index.js.map +1 -1
- package/link/batch-http/batchHttpLink.d.ts +1 -1
- package/link/batch-http/batchHttpLink.js +1 -1
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/batch-http/index.d.ts +1 -1
- package/link/batch-http/index.js +1 -1
- package/link/batch-http/index.js.map +1 -1
- package/link/client-awareness/ClientAwarenessLink.d.ts +1 -1
- package/link/client-awareness/ClientAwarenessLink.js +1 -1
- package/link/client-awareness/ClientAwarenessLink.js.map +1 -1
- package/link/client-awareness/index.d.ts +1 -1
- package/link/client-awareness/index.js +1 -1
- package/link/client-awareness/index.js.map +1 -1
- package/link/context/index.d.ts +1 -1
- package/link/context/index.js +1 -1
- package/link/context/index.js.map +1 -1
- package/link/core/concat.d.ts +1 -1
- package/link/core/concat.js +1 -1
- package/link/core/concat.js.map +1 -1
- package/link/core/empty.d.ts +1 -1
- package/link/core/empty.js +1 -1
- package/link/core/empty.js.map +1 -1
- package/link/core/execute.d.ts +1 -1
- package/link/core/execute.js +1 -1
- package/link/core/execute.js.map +1 -1
- package/link/core/from.d.ts +1 -1
- package/link/core/from.js +1 -1
- package/link/core/from.js.map +1 -1
- package/link/core/split.d.ts +1 -1
- package/link/core/split.js +1 -1
- package/link/core/split.js.map +1 -1
- package/link/core/types.d.ts +1 -1
- package/link/core/types.js +1 -1
- package/link/core/types.js.map +1 -1
- package/link/error/index.d.ts +1 -1
- package/link/error/index.js +1 -1
- package/link/error/index.js.map +1 -1
- package/link/http/BaseHttpLink.d.ts +1 -1
- package/link/http/BaseHttpLink.js +1 -1
- package/link/http/BaseHttpLink.js.map +1 -1
- package/link/http/HttpLink.d.ts +1 -1
- package/link/http/HttpLink.js +1 -1
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.d.ts +1 -1
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createSignalIfSupported.d.ts +1 -1
- package/link/http/createSignalIfSupported.js +1 -1
- package/link/http/createSignalIfSupported.js.map +1 -1
- package/link/http/index.d.ts +1 -1
- package/link/http/index.js +1 -1
- package/link/http/index.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.d.ts +1 -1
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +1 -1
- package/link/http/rewriteURIForGET.js +1 -1
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +1 -1
- package/link/http/selectHttpOptionsAndBody.js +1 -1
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/selectURI.d.ts +1 -1
- package/link/http/selectURI.js +1 -1
- package/link/http/selectURI.js.map +1 -1
- package/link/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/index.d.ts +1 -1
- package/link/index.js +1 -1
- package/link/index.js.map +1 -1
- package/link/persisted-queries/index.d.ts +1 -1
- package/link/remove-typename/index.d.ts +1 -1
- package/link/remove-typename/index.js.map +1 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts +1 -1
- package/link/remove-typename/removeTypenameFromVariables.js +1 -1
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/link/retry/delayFunction.d.ts +1 -1
- package/link/retry/delayFunction.js +1 -1
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/index.d.ts +1 -1
- package/link/retry/index.js +1 -1
- package/link/retry/index.js.map +1 -1
- package/link/retry/retryFunction.d.ts +1 -1
- package/link/retry/retryFunction.js +1 -1
- package/link/retry/retryFunction.js.map +1 -1
- package/link/retry/retryLink.d.ts +1 -1
- package/link/retry/retryLink.js +1 -1
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +1 -1
- package/link/schema/index.js +1 -1
- package/link/schema/index.js.map +1 -1
- package/link/subscriptions/index.d.ts +1 -1
- package/link/subscriptions/index.js +1 -1
- package/link/subscriptions/index.js.map +1 -1
- package/link/utils/createOperation.d.ts +1 -1
- package/link/utils/createOperation.js +1 -1
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/filterOperationVariables.d.ts +1 -1
- package/link/utils/filterOperationVariables.js +1 -1
- package/link/utils/filterOperationVariables.js.map +1 -1
- package/link/utils/index.d.ts +1 -1
- package/link/utils/index.js +1 -1
- package/link/utils/index.js.map +1 -1
- package/link/utils/transformOperation.d.ts +1 -1
- package/link/utils/transformOperation.js +1 -1
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/validateOperation.d.ts +1 -1
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +1 -1
- package/link/ws/index.js +1 -1
- package/link/ws/index.js.map +1 -1
- package/local-state/LocalState.d.ts +1 -1
- package/local-state/LocalState.js.map +1 -1
- package/local-state/index.d.ts +1 -1
- package/local-state/index.js +1 -1
- package/local-state/index.js.map +1 -1
- package/masking/GraphQLCodegenDataMasking.d.ts +1 -1
- package/masking/GraphQLCodegenDataMasking.js +1 -1
- package/masking/GraphQLCodegenDataMasking.js.map +1 -1
- package/masking/index.d.ts +1 -1
- package/masking/index.js +1 -1
- package/masking/index.js.map +1 -1
- package/masking/internal/types.d.ts +1 -1
- package/masking/internal/types.js +1 -1
- package/masking/internal/types.js.map +1 -1
- package/masking/maskDefinition.d.ts +1 -1
- package/masking/maskDefinition.js.map +1 -1
- package/masking/maskFragment.js.map +1 -1
- package/masking/maskOperation.js.map +1 -1
- package/masking/types.d.ts +1 -1
- package/masking/types.js +1 -1
- package/masking/types.js.map +1 -1
- package/masking/utils.js.map +1 -1
- package/package.json +10 -4
- package/react/compiled/index.d.ts +2 -0
- package/react/compiled/index.js +2 -0
- package/react/compiled/index.js.map +1 -0
- package/react/context/ApolloConsumer.d.ts +1 -1
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloContext.d.ts +1 -1
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.d.ts +1 -1
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/hooks/constants.d.ts +1 -1
- package/react/hooks/constants.js +1 -1
- package/react/hooks/constants.js.map +1 -1
- package/react/hooks/internal/__use.d.ts +1 -1
- package/react/hooks/internal/__use.js +1 -1
- package/react/hooks/internal/__use.js.map +1 -1
- package/react/hooks/internal/index.d.ts +1 -1
- package/react/hooks/internal/index.js +1 -1
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/internal/useDeepMemo.d.ts +1 -1
- package/react/hooks/internal/useDeepMemo.js +1 -1
- package/react/hooks/internal/useDeepMemo.js.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
- package/react/hooks/internal/useRenderGuard.d.ts +1 -1
- package/react/hooks/internal/useRenderGuard.js +1 -1
- package/react/hooks/internal/useRenderGuard.js.map +1 -1
- package/react/hooks/internal/validateSuspenseHookOptions.d.ts +1 -1
- package/react/hooks/internal/validateSuspenseHookOptions.js.map +1 -1
- package/react/hooks/internal/wrapHook.js.map +1 -1
- package/react/hooks/useApolloClient.d.ts +1 -1
- package/react/hooks/useApolloClient.js +1 -14
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useBackgroundQuery.js +7 -7
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.d.ts +1 -1
- package/react/hooks/useFragment.js +12 -12
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.js +14 -14
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.js +69 -229
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useMutation.js +82 -192
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.js +54 -225
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.js +24 -64
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useReactiveVar.d.ts +1 -1
- package/react/hooks/useReactiveVar.js +1 -1
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +1 -1
- package/react/hooks/useReadQuery.js +3 -3
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.js +4 -4
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseFragment.d.ts +1 -1
- package/react/hooks/useSuspenseFragment.js +1 -1
- package/react/hooks/useSuspenseFragment.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +34 -59
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.d.ts +1 -1
- package/react/hooks/useSyncExternalStore.js.map +1 -1
- package/react/hooks-compiled/constants.d.ts +3 -0
- package/react/hooks-compiled/constants.js +2 -0
- package/react/hooks-compiled/constants.js.map +1 -0
- package/react/hooks-compiled/internal/__use.d.ts +4 -0
- package/react/hooks-compiled/internal/__use.js +22 -0
- package/react/hooks-compiled/internal/__use.js.map +1 -0
- package/react/hooks-compiled/internal/index.d.ts +5 -0
- package/react/hooks-compiled/internal/index.js +6 -0
- package/react/hooks-compiled/internal/index.js.map +1 -0
- package/react/hooks-compiled/internal/useDeepMemo.d.ts +3 -0
- package/react/hooks-compiled/internal/useDeepMemo.js +13 -0
- package/react/hooks-compiled/internal/useDeepMemo.js.map +1 -0
- package/react/hooks-compiled/internal/useIsomorphicLayoutEffect.d.ts +3 -0
- package/react/hooks-compiled/internal/useIsomorphicLayoutEffect.js +9 -0
- package/react/hooks-compiled/internal/useIsomorphicLayoutEffect.js.map +1 -0
- package/react/hooks-compiled/internal/useRenderGuard.d.ts +2 -0
- package/react/hooks-compiled/internal/useRenderGuard.js +42 -0
- package/react/hooks-compiled/internal/useRenderGuard.js.map +1 -0
- package/react/hooks-compiled/internal/validateSuspenseHookOptions.d.ts +3 -0
- package/react/hooks-compiled/internal/validateSuspenseHookOptions.js +22 -0
- package/react/hooks-compiled/internal/validateSuspenseHookOptions.js.map +1 -0
- package/react/hooks-compiled/internal/wrapHook.d.ts +66 -0
- package/react/hooks-compiled/internal/wrapHook.js +64 -0
- package/react/hooks-compiled/internal/wrapHook.js.map +1 -0
- package/react/hooks-compiled/useApolloClient.d.ts +18 -0
- package/react/hooks-compiled/useApolloClient.js +36 -0
- package/react/hooks-compiled/useApolloClient.js.map +1 -0
- package/react/hooks-compiled/useBackgroundQuery.d.ts +210 -0
- package/react/hooks-compiled/useBackgroundQuery.js +80 -0
- package/react/hooks-compiled/useBackgroundQuery.js.map +1 -0
- package/react/hooks-compiled/useFragment.d.ts +55 -0
- package/react/hooks-compiled/useFragment.js +97 -0
- package/react/hooks-compiled/useFragment.js.map +1 -0
- package/react/hooks-compiled/useLazyQuery.d.ts +280 -0
- package/react/hooks-compiled/useLazyQuery.js +181 -0
- package/react/hooks-compiled/useLazyQuery.js.map +1 -0
- package/react/hooks-compiled/useLoadableQuery.d.ts +175 -0
- package/react/hooks-compiled/useLoadableQuery.js +247 -0
- package/react/hooks-compiled/useLoadableQuery.js.map +1 -0
- package/react/hooks-compiled/useMutation.d.ts +280 -0
- package/react/hooks-compiled/useMutation.js +263 -0
- package/react/hooks-compiled/useMutation.js.map +1 -0
- package/react/hooks-compiled/useQuery.d.ts +265 -0
- package/react/hooks-compiled/useQuery.js +395 -0
- package/react/hooks-compiled/useQuery.js.map +1 -0
- package/react/hooks-compiled/useQueryRefHandlers.d.ts +44 -0
- package/react/hooks-compiled/useQueryRefHandlers.js +109 -0
- package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -0
- package/react/hooks-compiled/useReactiveVar.d.ts +20 -0
- package/react/hooks-compiled/useReactiveVar.js +33 -0
- package/react/hooks-compiled/useReactiveVar.js.map +1 -0
- package/react/hooks-compiled/useReadQuery.d.ts +24 -0
- package/react/hooks-compiled/useReadQuery.js +43 -0
- package/react/hooks-compiled/useReadQuery.js.map +1 -0
- package/react/hooks-compiled/useSubscription.d.ts +178 -0
- package/react/hooks-compiled/useSubscription.js +223 -0
- package/react/hooks-compiled/useSubscription.js.map +1 -0
- package/react/hooks-compiled/useSuspenseFragment.d.ts +47 -0
- package/react/hooks-compiled/useSuspenseFragment.js +47 -0
- package/react/hooks-compiled/useSuspenseFragment.js.map +1 -0
- package/react/hooks-compiled/useSuspenseQuery.d.ts +204 -0
- package/react/hooks-compiled/useSuspenseQuery.js +144 -0
- package/react/hooks-compiled/useSuspenseQuery.js.map +1 -0
- package/react/hooks-compiled/useSyncExternalStore.d.ts +4 -0
- package/react/hooks-compiled/useSyncExternalStore.js +126 -0
- package/react/hooks-compiled/useSyncExternalStore.js.map +1 -0
- package/react/index.compiled.d.ts +26 -0
- package/react/index.compiled.js +21 -0
- package/react/index.compiled.js.map +1 -0
- package/react/index.d.ts +2 -1
- package/react/index.js +2 -1
- package/react/index.js.map +1 -1
- package/react/index.react-server.d.ts +1 -1
- package/react/index.react-server.js +1 -1
- package/react/index.react-server.js.map +1 -1
- package/react/internal/cache/FragmentReference.d.ts +1 -1
- package/react/internal/cache/FragmentReference.js +1 -1
- package/react/internal/cache/FragmentReference.js.map +1 -1
- package/react/internal/cache/SuspenseCache.d.ts +1 -1
- package/react/internal/cache/SuspenseCache.js +1 -1
- package/react/internal/cache/SuspenseCache.js.map +1 -1
- package/react/internal/cache/getSuspenseCache.d.ts +1 -1
- package/react/internal/cache/getSuspenseCache.js +1 -1
- package/react/internal/cache/getSuspenseCache.js.map +1 -1
- package/react/internal/cache/types.d.ts +1 -1
- package/react/internal/cache/types.js +1 -1
- package/react/internal/cache/types.js.map +1 -1
- package/react/internal/compiler-runtime/index.d.ts +8 -0
- package/react/internal/compiler-runtime/index.js +28 -0
- package/react/internal/compiler-runtime/index.js.map +1 -0
- package/react/internal/index.d.ts +1 -1
- package/react/internal/index.js +1 -1
- package/react/internal/index.js.map +1 -1
- package/react/internal/types.d.ts +1 -1
- package/react/internal/types.js +1 -1
- package/react/internal/types.js.map +1 -1
- package/react/query-preloader/createQueryPreloader.js +1 -1
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/ssr/getDataFromTree.d.ts +1 -1
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/index.d.ts +1 -1
- package/react/ssr/index.js +1 -1
- package/react/ssr/index.js.map +1 -1
- package/react/ssr/prerenderStatic.d.ts +1 -1
- package/react/ssr/renderToStringWithData.d.ts +1 -1
- package/react/ssr/renderToStringWithData.js +1 -1
- package/react/ssr/renderToStringWithData.js.map +1 -1
- package/react/ssr/useSSRQuery.d.ts +1 -1
- package/react/ssr/useSSRQuery.js +1 -1
- package/react/ssr/useSSRQuery.js.map +1 -1
- package/react/types/deprecated.d.ts +1 -1
- package/react/types/deprecated.js +1 -1
- package/react/types/deprecated.js.map +1 -1
- package/react/types/types.documentation.js +1 -1
- package/react/types/types.documentation.js.map +1 -1
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/types/deprecated.d.ts +1 -1
- package/testing/core/types/deprecated.js +1 -1
- package/testing/core/types/deprecated.js.map +1 -1
- package/testing/index.d.ts +1 -1
- package/testing/index.js +1 -1
- package/testing/index.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +1 -1
- package/testing/react/MockedProvider.js +1 -1
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/react/index.d.ts +1 -1
- package/testing/react/index.js +1 -1
- package/testing/react/index.js.map +1 -1
- package/utilities/DeepPartial.d.ts +1 -1
- package/utilities/DeepPartial.js +1 -1
- package/utilities/DeepPartial.js.map +1 -1
- package/utilities/HKT.d.ts +1 -1
- package/utilities/HKT.js +1 -1
- package/utilities/HKT.js.map +1 -1
- package/utilities/caching/index.d.ts +1 -1
- package/utilities/caching/index.js +1 -1
- package/utilities/caching/index.js.map +1 -1
- package/utilities/caching/sizes.d.ts +1 -1
- package/utilities/caching/sizes.js +1 -1
- package/utilities/caching/sizes.js.map +1 -1
- package/utilities/common/stripTypename.d.ts +1 -1
- package/utilities/common/stripTypename.js +1 -1
- package/utilities/common/stripTypename.js.map +1 -1
- package/utilities/environment/index.d.ts +1 -1
- package/utilities/environment/index.development.d.ts +1 -1
- package/utilities/environment/index.development.js +1 -1
- package/utilities/environment/index.development.js.map +1 -1
- package/utilities/environment/index.js +1 -1
- package/utilities/environment/index.js.map +1 -1
- package/utilities/environment/index.production.d.ts +1 -1
- package/utilities/environment/index.production.js +1 -1
- package/utilities/environment/index.production.js.map +1 -1
- package/utilities/graphql/isFormattedExecutionResult.d.ts +1 -1
- package/utilities/graphql/isFormattedExecutionResult.js +1 -1
- package/utilities/graphql/isFormattedExecutionResult.js.map +1 -1
- package/utilities/graphql/operations.d.ts +1 -1
- package/utilities/graphql/operations.js +1 -1
- package/utilities/graphql/operations.js.map +1 -1
- package/utilities/graphql/print.d.ts +1 -1
- package/utilities/graphql/print.js +1 -1
- package/utilities/graphql/print.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +1 -1
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts +1 -1
- package/utilities/graphql/transform.js +1 -1
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +1 -1
- package/utilities/index.js +1 -1
- package/utilities/index.js.map +1 -1
- package/utilities/internal/argumentsObjectFromField.js.map +1 -1
- package/utilities/internal/caches.js.map +1 -1
- package/utilities/internal/canUseDOM.js.map +1 -1
- package/utilities/internal/checkDocument.js.map +1 -1
- package/utilities/internal/cloneDeep.js.map +1 -1
- package/utilities/internal/compact.js.map +1 -1
- package/utilities/internal/createFragmentMap.js.map +1 -1
- package/utilities/internal/createFulfilledPromise.js.map +1 -1
- package/utilities/internal/createRejectedPromise.js.map +1 -1
- package/utilities/internal/dealias.d.ts +1 -1
- package/utilities/internal/dealias.js +1 -1
- package/utilities/internal/dealias.js.map +1 -1
- package/utilities/internal/decoratePromise.js.map +1 -1
- package/utilities/internal/deepFreeze.js.map +1 -1
- package/utilities/internal/filterMap.d.ts +1 -1
- package/utilities/internal/filterMap.js +1 -1
- package/utilities/internal/filterMap.js.map +1 -1
- package/utilities/internal/getDefaultValues.js.map +1 -1
- package/utilities/internal/getFragmentDefinition.js.map +1 -1
- package/utilities/internal/getFragmentDefinitions.js.map +1 -1
- package/utilities/internal/getFragmentFromSelection.js.map +1 -1
- package/utilities/internal/getFragmentQueryDocument.js.map +1 -1
- package/utilities/internal/getGraphQLErrorsFromResult.js.map +1 -1
- package/utilities/internal/getMainDefinition.js.map +1 -1
- package/utilities/internal/getMemoryInternals.js.map +1 -1
- package/utilities/internal/getOperationDefinition.js.map +1 -1
- package/utilities/internal/getOperationName.js.map +1 -1
- package/utilities/internal/getQueryDefinition.js.map +1 -1
- package/utilities/internal/getStoreKeyName.js.map +1 -1
- package/utilities/internal/globals/global.d.ts +1 -1
- package/utilities/internal/globals/index.d.ts +1 -1
- package/utilities/internal/globals/index.js +1 -1
- package/utilities/internal/globals/index.js.map +1 -1
- package/utilities/internal/globals/maybe.d.ts +1 -1
- package/utilities/internal/globals/maybe.js +1 -1
- package/utilities/internal/globals/maybe.js.map +1 -1
- package/utilities/internal/graphQLResultHasError.js.map +1 -1
- package/utilities/internal/hasDirectives.js.map +1 -1
- package/utilities/internal/hasForcedResolvers.d.ts +1 -1
- package/utilities/internal/hasForcedResolvers.js +1 -1
- package/utilities/internal/hasForcedResolvers.js.map +1 -1
- package/utilities/internal/index.d.ts +1 -1
- package/utilities/internal/index.js +1 -1
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/index.production.d.ts +1 -1
- package/utilities/internal/index.production.js +1 -1
- package/utilities/internal/index.production.js.map +1 -1
- package/utilities/internal/isArray.js.map +1 -1
- package/utilities/internal/isDocumentNode.js.map +1 -1
- package/utilities/internal/isField.js.map +1 -1
- package/utilities/internal/isNonEmptyArray.js.map +1 -1
- package/utilities/internal/isNonNullObject.js.map +1 -1
- package/utilities/internal/isPlainObject.js.map +1 -1
- package/utilities/internal/makeReference.js.map +1 -1
- package/utilities/internal/makeUniqueId.js.map +1 -1
- package/utilities/internal/maybeDeepFreeze.js.map +1 -1
- package/utilities/internal/mergeDeep.js.map +1 -1
- package/utilities/internal/mergeDeepArray.js.map +1 -1
- package/utilities/internal/mergeOptions.js.map +1 -1
- package/utilities/internal/omitDeep.js.map +1 -1
- package/utilities/internal/preventUnhandledRejection.d.ts +1 -1
- package/utilities/internal/preventUnhandledRejection.js +1 -1
- package/utilities/internal/preventUnhandledRejection.js.map +1 -1
- package/utilities/internal/removeDirectivesFromDocument.js.map +1 -1
- package/utilities/internal/resultKeyNameFromField.js.map +1 -1
- package/utilities/internal/shouldInclude.js.map +1 -1
- package/utilities/internal/storeKeyNameFromField.js.map +1 -1
- package/utilities/internal/stringifyForDisplay.js.map +1 -1
- package/utilities/internal/toQueryResult.js.map +1 -1
- package/utilities/internal/types/ApplyHKT.js +1 -1
- package/utilities/internal/types/ApplyHKT.js.map +1 -1
- package/utilities/internal/types/ApplyHKTImplementationWithDefault.js +1 -1
- package/utilities/internal/types/ApplyHKTImplementationWithDefault.js.map +1 -1
- package/utilities/internal/types/DecoratedPromise.js +1 -1
- package/utilities/internal/types/DecoratedPromise.js.map +1 -1
- package/utilities/internal/types/DeepOmit.js +1 -1
- package/utilities/internal/types/DeepOmit.js.map +1 -1
- package/utilities/internal/types/FragmentMap.js +1 -1
- package/utilities/internal/types/FragmentMap.js.map +1 -1
- package/utilities/internal/types/FragmentMapFunction.js +1 -1
- package/utilities/internal/types/FragmentMapFunction.js.map +1 -1
- package/utilities/internal/types/FulfilledPromise.js +1 -1
- package/utilities/internal/types/FulfilledPromise.js.map +1 -1
- package/utilities/internal/types/IsAny.js +1 -1
- package/utilities/internal/types/IsAny.js.map +1 -1
- package/utilities/internal/types/NoInfer.d.ts +1 -1
- package/utilities/internal/types/NoInfer.js +1 -1
- package/utilities/internal/types/NoInfer.js.map +1 -1
- package/utilities/internal/types/PendingPromise.js +1 -1
- package/utilities/internal/types/PendingPromise.js.map +1 -1
- package/utilities/internal/types/Prettify.js +1 -1
- package/utilities/internal/types/Prettify.js.map +1 -1
- package/utilities/internal/types/Primitive.js +1 -1
- package/utilities/internal/types/Primitive.js.map +1 -1
- package/utilities/internal/types/RejectedPromise.js +1 -1
- package/utilities/internal/types/RejectedPromise.js.map +1 -1
- package/utilities/internal/types/RemoveIndexSignature.js +1 -1
- package/utilities/internal/types/RemoveIndexSignature.js.map +1 -1
- package/utilities/internal/types/TupleToIntersection.d.ts +1 -1
- package/utilities/internal/types/TupleToIntersection.js +1 -1
- package/utilities/internal/types/TupleToIntersection.js.map +1 -1
- package/utilities/internal/types/VariablesOption.js +1 -1
- package/utilities/internal/types/VariablesOption.js.map +1 -1
- package/utilities/internal/valueToObjectRepresentation.js.map +1 -1
- package/utilities/invariant/index.d.ts +1 -1
- package/utilities/invariant/index.development.d.ts +1 -1
- package/utilities/invariant/index.development.js +1 -1
- package/utilities/invariant/index.development.js.map +1 -1
- package/utilities/invariant/index.js +1 -1
- package/utilities/invariant/index.js.map +1 -1
- package/utilities/policies/pagination.d.ts +1 -1
- package/utilities/policies/pagination.js +1 -1
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/shared/canonicalStringify.d.ts +1 -1
- package/utilities/shared/canonicalStringify.js +1 -1
- package/utilities/shared/canonicalStringify.js.map +1 -1
- package/utilities/subscriptions/relay/index.d.ts +1 -1
- package/utilities/subscriptions/relay/index.js +1 -1
- package/utilities/subscriptions/relay/index.js.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
let Ctx;
|
|
3
|
+
function noop() { }
|
|
4
|
+
export function useRenderGuard() {
|
|
5
|
+
if (!Ctx) {
|
|
6
|
+
// we want the intialization to be lazy because `createContext` would error on import in a RSC
|
|
7
|
+
Ctx = React.createContext(null);
|
|
8
|
+
}
|
|
9
|
+
return React.useCallback(
|
|
10
|
+
/**
|
|
11
|
+
* @returns true if the hook was called during render
|
|
12
|
+
*/ () => {
|
|
13
|
+
const orig = console.error;
|
|
14
|
+
try {
|
|
15
|
+
console.error = noop;
|
|
16
|
+
/**
|
|
17
|
+
* `useContext` can be called conditionally during render, so this is safe.
|
|
18
|
+
* (Also, during render we would want to throw as a reaction to this anyways, so it
|
|
19
|
+
* wouldn't even matter if we got the order of hooks mixed up...)
|
|
20
|
+
*
|
|
21
|
+
* They cannot however be called outside of Render, and that's what we're testing here.
|
|
22
|
+
*
|
|
23
|
+
* Different versions of React have different behaviour on an invalid hook call:
|
|
24
|
+
*
|
|
25
|
+
* React 16.8 - 17: throws an error
|
|
26
|
+
* https://github.com/facebook/react/blob/2b93d686e359c7afa299e2ec5cf63160a32a1155/packages/react/src/ReactHooks.js#L18-L26
|
|
27
|
+
*
|
|
28
|
+
* React 18 & 19: `console.error` in development, then `resolveDispatcher` returns `null` and a member access on `null` throws.
|
|
29
|
+
* https://github.com/facebook/react/blob/58e8304483ebfadd02a295339b5e9a989ac98c6e/packages/react/src/ReactHooks.js#L28-L35
|
|
30
|
+
*/
|
|
31
|
+
React["useContext" /* hide this from the linter */](Ctx);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
console.error = orig;
|
|
39
|
+
}
|
|
40
|
+
}, []);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=useRenderGuard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRenderGuard.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useRenderGuard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,IAAI,GAAwB,CAAC;AAE7B,SAAS,IAAI,KAAI,CAAC;AAClB,MAAM,UAAU,cAAc;IAC5B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,8FAA8F;QAC9F,GAAG,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,KAAK,CAAC,WAAW;IACtB;;OAEG,CAAC,GAAG,EAAE;QACP,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC;YACH,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;YAErB;;;;;;;;;;;;;;eAcG;YACH,KAAK,CAAC,YAAY,CAAC,+BAA+B,CAAC,CAAC,GAAG,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACf,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC,EACD,EAAE,CACH,CAAC;AACJ,CAAC","sourcesContent":["import * as React from \"react\";\n\nlet Ctx: React.Context<null>;\n\nfunction noop() {}\nexport function useRenderGuard() {\n if (!Ctx) {\n // we want the intialization to be lazy because `createContext` would error on import in a RSC\n Ctx = React.createContext(null);\n }\n\n return React.useCallback(\n /**\n * @returns true if the hook was called during render\n */ () => {\n const orig = console.error;\n try {\n console.error = noop;\n\n /**\n * `useContext` can be called conditionally during render, so this is safe.\n * (Also, during render we would want to throw as a reaction to this anyways, so it\n * wouldn't even matter if we got the order of hooks mixed up...)\n *\n * They cannot however be called outside of Render, and that's what we're testing here.\n *\n * Different versions of React have different behaviour on an invalid hook call:\n *\n * React 16.8 - 17: throws an error\n * https://github.com/facebook/react/blob/2b93d686e359c7afa299e2ec5cf63160a32a1155/packages/react/src/ReactHooks.js#L18-L26\n *\n * React 18 & 19: `console.error` in development, then `resolveDispatcher` returns `null` and a member access on `null` throws.\n * https://github.com/facebook/react/blob/58e8304483ebfadd02a295339b5e9a989ac98c6e/packages/react/src/ReactHooks.js#L28-L35\n */\n React[\"useContext\" /* hide this from the linter */](Ctx);\n return true;\n } catch (e) {\n return false;\n } finally {\n console.error = orig;\n }\n },\n []\n );\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { OperationVariables, WatchQueryOptions } from "@apollo/client";
|
|
2
|
+
export declare function validateSuspenseHookOptions<TData, TVariables extends OperationVariables>(options: WatchQueryOptions<TVariables, TData>): void;
|
|
3
|
+
//# sourceMappingURL=validateSuspenseHookOptions.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { __DEV__ } from "@apollo/client/utilities/environment";
|
|
2
|
+
import { invariant } from "@apollo/client/utilities/invariant";
|
|
3
|
+
export function validateSuspenseHookOptions(options) {
|
|
4
|
+
const { fetchPolicy, returnPartialData } = options;
|
|
5
|
+
validateFetchPolicy(fetchPolicy);
|
|
6
|
+
validatePartialDataReturn(fetchPolicy, returnPartialData);
|
|
7
|
+
}
|
|
8
|
+
function validateFetchPolicy(fetchPolicy = "cache-first") {
|
|
9
|
+
const supportedFetchPolicies = [
|
|
10
|
+
"cache-first",
|
|
11
|
+
"network-only",
|
|
12
|
+
"no-cache",
|
|
13
|
+
"cache-and-network",
|
|
14
|
+
];
|
|
15
|
+
invariant(supportedFetchPolicies.includes(fetchPolicy), 35, fetchPolicy);
|
|
16
|
+
}
|
|
17
|
+
function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
18
|
+
if (fetchPolicy === "no-cache" && returnPartialData) {
|
|
19
|
+
__DEV__ && invariant.warn(36);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=validateSuspenseHookOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateSuspenseHookOptions.js","sources":["../../../../src/react/hooks/internal/validateSuspenseHookOptions.ts"],"sourcesContent":["import type {\n OperationVariables,\n WatchQueryFetchPolicy,\n WatchQueryOptions,\n} from \"@apollo/client\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nexport function validateSuspenseHookOptions<\n TData,\n TVariables extends OperationVariables,\n>(options: WatchQueryOptions<TVariables, TData>) {\n const { fetchPolicy, returnPartialData } = options;\n\n validateFetchPolicy(fetchPolicy);\n validatePartialDataReturn(fetchPolicy, returnPartialData);\n}\n\nfunction validateFetchPolicy(\n fetchPolicy: WatchQueryFetchPolicy = \"cache-first\"\n) {\n const supportedFetchPolicies: WatchQueryFetchPolicy[] = [\n \"cache-first\",\n \"network-only\",\n \"no-cache\",\n \"cache-and-network\",\n ];\n\n invariant(\n supportedFetchPolicies.includes(fetchPolicy),\n `The fetch policy \\`%s\\` is not supported with suspense.`,\n fetchPolicy\n );\n}\n\nfunction validatePartialDataReturn(\n fetchPolicy: WatchQueryFetchPolicy | undefined,\n returnPartialData: boolean | undefined\n) {\n if (fetchPolicy === \"no-cache\" && returnPartialData) {\n invariant.warn(\n \"Using `returnPartialData` with a `no-cache` fetch policy has no effect. To read partial data from the cache, consider using an alternate fetch policy.\"\n );\n }\n}\n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client";
|
|
3
|
+
import type { createQueryPreloader } from "@apollo/client/react";
|
|
4
|
+
import type { useBackgroundQuery, useFragment, useQuery, useQueryRefHandlers, useReadQuery, useSuspenseFragment, useSuspenseQuery } from "@apollo/client/react";
|
|
5
|
+
export declare const wrapperSymbol: unique symbol;
|
|
6
|
+
type FunctionSignature<T> = T extends (...args: infer A) => infer R ? (...args: A) => R : never;
|
|
7
|
+
interface WrappableHooks {
|
|
8
|
+
createQueryPreloader: typeof createQueryPreloader;
|
|
9
|
+
useQuery: FunctionSignature<typeof useQuery>;
|
|
10
|
+
useSuspenseQuery: typeof useSuspenseQuery;
|
|
11
|
+
useSuspenseFragment: typeof useSuspenseFragment;
|
|
12
|
+
useBackgroundQuery: typeof useBackgroundQuery;
|
|
13
|
+
useReadQuery: typeof useReadQuery;
|
|
14
|
+
useFragment: typeof useFragment;
|
|
15
|
+
useQueryRefHandlers: typeof useQueryRefHandlers;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
* Can be used to correctly type the [Symbol.for("apollo.hook.wrappers")] property of
|
|
20
|
+
* `QueryManager`, to override/wrap hook functionality.
|
|
21
|
+
*
|
|
22
|
+
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
23
|
+
*/
|
|
24
|
+
export type HookWrappers = {
|
|
25
|
+
[K in keyof WrappableHooks]?: (originalHook: WrappableHooks[K]) => WrappableHooks[K];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*
|
|
30
|
+
* Makes an Apollo Client hook "wrappable".
|
|
31
|
+
* That means that the Apollo Client instance can expose a "wrapper" that will be
|
|
32
|
+
* used to wrap the original hook implementation with additional logic.
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // this is already done in `@apollo/client` for all wrappable hooks (see `WrappableHooks`)
|
|
36
|
+
* // following this pattern
|
|
37
|
+
* function useQuery() {
|
|
38
|
+
* return wrapHook('useQuery', _useQuery, options.client)(query, options);
|
|
39
|
+
* }
|
|
40
|
+
* function _useQuery(query, options) {
|
|
41
|
+
* // original implementation
|
|
42
|
+
* }
|
|
43
|
+
*
|
|
44
|
+
* // this is what a library like `@apollo/client-react-streaming` would do
|
|
45
|
+
* class ApolloClientWithStreaming extends ApolloClient {
|
|
46
|
+
* constructor(options) {
|
|
47
|
+
* super(options);
|
|
48
|
+
* this.queryManager[Symbol.for("apollo.hook.wrappers")] = {
|
|
49
|
+
* useQuery: (original) => (query, options) => {
|
|
50
|
+
* console.log("useQuery was called with options", options);
|
|
51
|
+
* return original(query, options);
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
* }
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
* // this will now log the options and then call the original `useQuery`
|
|
58
|
+
* const client = new ApolloClientWithStreaming({ ... });
|
|
59
|
+
* useQuery(query, { client });
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
63
|
+
*/
|
|
64
|
+
export declare function wrapHook<Hook extends (...args: any[]) => any>(hookName: keyof WrappableHooks, useHook: Hook, clientOrObsQuery: ObservableQuery<any> | ApolloClient): Hook;
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=wrapHook.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
// direct import to avoid circular dependency
|
|
3
|
+
import { getApolloContext } from "../../context/ApolloContext.js";
|
|
4
|
+
export const wrapperSymbol = Symbol.for("apollo.hook.wrappers");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*
|
|
8
|
+
* Makes an Apollo Client hook "wrappable".
|
|
9
|
+
* That means that the Apollo Client instance can expose a "wrapper" that will be
|
|
10
|
+
* used to wrap the original hook implementation with additional logic.
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // this is already done in `@apollo/client` for all wrappable hooks (see `WrappableHooks`)
|
|
14
|
+
* // following this pattern
|
|
15
|
+
* function useQuery() {
|
|
16
|
+
* return wrapHook('useQuery', _useQuery, options.client)(query, options);
|
|
17
|
+
* }
|
|
18
|
+
* function _useQuery(query, options) {
|
|
19
|
+
* // original implementation
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* // this is what a library like `@apollo/client-react-streaming` would do
|
|
23
|
+
* class ApolloClientWithStreaming extends ApolloClient {
|
|
24
|
+
* constructor(options) {
|
|
25
|
+
* super(options);
|
|
26
|
+
* this.queryManager[Symbol.for("apollo.hook.wrappers")] = {
|
|
27
|
+
* useQuery: (original) => (query, options) => {
|
|
28
|
+
* console.log("useQuery was called with options", options);
|
|
29
|
+
* return original(query, options);
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* // this will now log the options and then call the original `useQuery`
|
|
36
|
+
* const client = new ApolloClientWithStreaming({ ... });
|
|
37
|
+
* useQuery(query, { client });
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
41
|
+
*/
|
|
42
|
+
export function wrapHook(hookName, useHook, clientOrObsQuery) {
|
|
43
|
+
// Priority-wise, the later entries in this array wrap
|
|
44
|
+
// previous entries and could prevent them (and in the end,
|
|
45
|
+
// even the original hook) from running
|
|
46
|
+
const wrapperSources = [
|
|
47
|
+
clientOrObsQuery["queryManager"],
|
|
48
|
+
// if we are a hook (not `preloadQuery`), we are guaranteed to be inside of
|
|
49
|
+
// a React render and can use context
|
|
50
|
+
hookName.startsWith("use") ?
|
|
51
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
52
|
+
React.useContext(getApolloContext())
|
|
53
|
+
: undefined,
|
|
54
|
+
];
|
|
55
|
+
let wrapped = useHook;
|
|
56
|
+
for (const source of wrapperSources) {
|
|
57
|
+
const wrapper = source?.[wrapperSymbol]?.[hookName];
|
|
58
|
+
if (wrapper) {
|
|
59
|
+
wrapped = wrapper(wrapped);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return wrapped;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=wrapHook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapHook.js","sources":["../../../../src/react/hooks/internal/wrapHook.ts"],"sourcesContent":["import * as React from \"react\";\n\nimport type { ApolloClient } from \"@apollo/client\";\nimport type { ObservableQuery } from \"@apollo/client\";\nimport type { createQueryPreloader } from \"@apollo/client/react\";\nimport type {\n useBackgroundQuery,\n useFragment,\n useQuery,\n useQueryRefHandlers,\n useReadQuery,\n useSuspenseFragment,\n useSuspenseQuery,\n} from \"@apollo/client/react\";\n\nimport type { QueryManager } from \"../../../core/QueryManager.js\";\n// direct import to avoid circular dependency\nimport { getApolloContext } from \"../../context/ApolloContext.js\";\n\nexport const wrapperSymbol = Symbol.for(\"apollo.hook.wrappers\");\n\ntype FunctionSignature<T> =\n T extends (...args: infer A) => infer R ? (...args: A) => R : never;\n\ninterface WrappableHooks {\n createQueryPreloader: typeof createQueryPreloader;\n useQuery: FunctionSignature<typeof useQuery>;\n useSuspenseQuery: typeof useSuspenseQuery;\n useSuspenseFragment: typeof useSuspenseFragment;\n useBackgroundQuery: typeof useBackgroundQuery;\n useReadQuery: typeof useReadQuery;\n useFragment: typeof useFragment;\n useQueryRefHandlers: typeof useQueryRefHandlers;\n}\n\n/**\n * @internal\n * Can be used to correctly type the [Symbol.for(\"apollo.hook.wrappers\")] property of\n * `QueryManager`, to override/wrap hook functionality.\n */\nexport type HookWrappers = {\n [K in keyof WrappableHooks]?: (\n originalHook: WrappableHooks[K]\n ) => WrappableHooks[K];\n};\n\ninterface QueryManagerWithWrappers extends QueryManager {\n [wrapperSymbol]?: HookWrappers;\n}\n\n/**\n * @internal\n *\n * Makes an Apollo Client hook \"wrappable\".\n * That means that the Apollo Client instance can expose a \"wrapper\" that will be\n * used to wrap the original hook implementation with additional logic.\n * @example\n * ```tsx\n * // this is already done in `@apollo/client` for all wrappable hooks (see `WrappableHooks`)\n * // following this pattern\n * function useQuery() {\n * return wrapHook('useQuery', _useQuery, options.client)(query, options);\n * }\n * function _useQuery(query, options) {\n * // original implementation\n * }\n *\n * // this is what a library like `@apollo/client-react-streaming` would do\n * class ApolloClientWithStreaming extends ApolloClient {\n * constructor(options) {\n * super(options);\n * this.queryManager[Symbol.for(\"apollo.hook.wrappers\")] = {\n * useQuery: (original) => (query, options) => {\n * console.log(\"useQuery was called with options\", options);\n * return original(query, options);\n * }\n * }\n * }\n * }\n *\n * // this will now log the options and then call the original `useQuery`\n * const client = new ApolloClientWithStreaming({ ... });\n * useQuery(query, { client });\n * ```\n */\nexport function wrapHook<Hook extends (...args: any[]) => any>(\n hookName: keyof WrappableHooks,\n useHook: Hook,\n clientOrObsQuery: ObservableQuery<any> | ApolloClient\n): Hook {\n // Priority-wise, the later entries in this array wrap\n // previous entries and could prevent them (and in the end,\n // even the original hook) from running\n const wrapperSources = [\n (\n clientOrObsQuery as unknown as {\n // both `ApolloClient` and `ObservableQuery` have a `queryManager` property\n // but they're both `private`, so we have to cast around for a bit here.\n queryManager: QueryManagerWithWrappers;\n }\n )[\"queryManager\"],\n // if we are a hook (not `preloadQuery`), we are guaranteed to be inside of\n // a React render and can use context\n hookName.startsWith(\"use\") ?\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useContext(getApolloContext())\n : undefined,\n ];\n\n let wrapped = useHook;\n for (const source of wrapperSources) {\n const wrapper = source?.[wrapperSymbol]?.[hookName];\n if (wrapper) {\n wrapped = wrapper(wrapped) as Hook;\n }\n }\n\n return wrapped;\n}\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,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client';
|
|
6
|
+
*
|
|
7
|
+
* function SomeComponent() {
|
|
8
|
+
* const client = useApolloClient();
|
|
9
|
+
* // `client` is now set to the `ApolloClient` instance being used by the
|
|
10
|
+
* // application (that was configured using something like `ApolloProvider`)
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @since 3.0.0
|
|
15
|
+
* @returns The `ApolloClient` instance being used by the application.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useApolloClient(override?: ApolloClient): ApolloClient;
|
|
18
|
+
//# sourceMappingURL=useApolloClient.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { c as _c } from "@apollo/client/react/internal/compiler-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { invariant } from "@apollo/client/utilities/invariant";
|
|
4
|
+
import { getApolloContext } from "../context/ApolloContext.js";
|
|
5
|
+
/**
|
|
6
|
+
* @example
|
|
7
|
+
* ```jsx
|
|
8
|
+
* import { useApolloClient } from '@apollo/client';
|
|
9
|
+
*
|
|
10
|
+
* function SomeComponent() {
|
|
11
|
+
* const client = useApolloClient();
|
|
12
|
+
* // `client` is now set to the `ApolloClient` instance being used by the
|
|
13
|
+
* // application (that was configured using something like `ApolloProvider`)
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @since 3.0.0
|
|
18
|
+
* @returns The `ApolloClient` instance being used by the application.
|
|
19
|
+
*/
|
|
20
|
+
export function useApolloClient(override) {
|
|
21
|
+
const $ = _c(1);
|
|
22
|
+
let t0;
|
|
23
|
+
|
|
24
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
25
|
+
t0 = getApolloContext();
|
|
26
|
+
$[0] = t0;
|
|
27
|
+
} else {
|
|
28
|
+
t0 = $[0];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const context = React.useContext(t0);
|
|
32
|
+
const client = override || context.client;
|
|
33
|
+
invariant(!!client, 28);
|
|
34
|
+
return client;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=useApolloClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useApolloClient.js","sources":["../../../src/react/hooks/useApolloClient.ts"],"sourcesContent":["import * as React from \"react\";\n\nimport type { ApolloClient } from \"@apollo/client\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nimport { getApolloContext } from \"../context/ApolloContext.js\";\n\n/**\n * @example\n * ```jsx\n * import { useApolloClient } from '@apollo/client';\n *\n * function SomeComponent() {\n * const client = useApolloClient();\n * // `client` is now set to the `ApolloClient` instance being used by the\n * // application (that was configured using something like `ApolloProvider`)\n * }\n * ```\n *\n * @since 3.0.0\n * @returns The `ApolloClient` instance being used by the application.\n */\nexport function useApolloClient(override?: ApolloClient): ApolloClient {\n const context = React.useContext(getApolloContext());\n const client = override || context.client;\n invariant(\n !!client,\n 'Could not find \"client\" in the context or passed in as an option. ' +\n \"Wrap the root component in an <ApolloProvider>, or pass an ApolloClient \" +\n \"instance in via options.\"\n );\n\n return client;\n}\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;AAG9B,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAA0B,CAA1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8D;AAE9D,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAiC,CAAjC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8D;AAE9D,CAAA,CAAA;;;;;;;;;;;;;;CAcA,CAAA;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import type { ApolloClient, DefaultContext, DocumentNode, ErrorPolicy, OperationVariables, RefetchWritePolicy, TypedDocumentNode, WatchQueryFetchPolicy } from "@apollo/client";
|
|
2
|
+
import type { SubscribeToMoreFunction } from "@apollo/client";
|
|
3
|
+
import type { FetchMoreFunction, QueryRef, RefetchFunction } from "@apollo/client/react/internal";
|
|
4
|
+
import type { NoInfer, VariablesOption } from "@apollo/client/utilities/internal";
|
|
5
|
+
import type { SkipToken } from "./constants.js";
|
|
6
|
+
export declare namespace useBackgroundQuery {
|
|
7
|
+
type FetchPolicy = Extract<WatchQueryFetchPolicy, "cache-first" | "network-only" | "no-cache" | "cache-and-network">;
|
|
8
|
+
type Options<TVariables extends OperationVariables = OperationVariables> = {
|
|
9
|
+
/**
|
|
10
|
+
* The instance of `ApolloClient` to use to execute the query.
|
|
11
|
+
*
|
|
12
|
+
* By default, the instance that's passed down via context is used, but you can provide a different instance here.
|
|
13
|
+
*
|
|
14
|
+
* @docGroup
|
|
15
|
+
*
|
|
16
|
+
* 1. Operation options
|
|
17
|
+
*/
|
|
18
|
+
client?: ApolloClient;
|
|
19
|
+
/**
|
|
20
|
+
* Specifies whether a `NetworkStatus.refetch` operation should merge incoming field data with existing data, or overwrite the existing data. Overwriting is probably preferable, but merging is currently the default behavior, for backwards compatibility with Apollo Client 3.x.
|
|
21
|
+
*
|
|
22
|
+
* @docGroup
|
|
23
|
+
*
|
|
24
|
+
* 3. Caching options
|
|
25
|
+
*/
|
|
26
|
+
refetchWritePolicy?: RefetchWritePolicy;
|
|
27
|
+
/**
|
|
28
|
+
* Specifies how the query handles a response that returns both GraphQL errors and partial results.
|
|
29
|
+
*
|
|
30
|
+
* For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
|
|
31
|
+
*
|
|
32
|
+
* The default value is `none`, meaning that the query result includes error details but not partial results.
|
|
33
|
+
*
|
|
34
|
+
* @docGroup
|
|
35
|
+
*
|
|
36
|
+
* 1. Operation options
|
|
37
|
+
*/
|
|
38
|
+
errorPolicy?: ErrorPolicy;
|
|
39
|
+
/**
|
|
40
|
+
* If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.
|
|
41
|
+
*
|
|
42
|
+
* @docGroup
|
|
43
|
+
*
|
|
44
|
+
* 2. Networking options
|
|
45
|
+
*/
|
|
46
|
+
context?: DefaultContext;
|
|
47
|
+
/**
|
|
48
|
+
* If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields.
|
|
49
|
+
*
|
|
50
|
+
* The default value is `false`.
|
|
51
|
+
*
|
|
52
|
+
* @docGroup
|
|
53
|
+
*
|
|
54
|
+
* 3. Caching options
|
|
55
|
+
*/
|
|
56
|
+
returnPartialData?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server).
|
|
59
|
+
*
|
|
60
|
+
* For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).
|
|
61
|
+
*
|
|
62
|
+
* The default value is `cache-first`.
|
|
63
|
+
*
|
|
64
|
+
* @docGroup
|
|
65
|
+
*
|
|
66
|
+
* 3. Caching options
|
|
67
|
+
*/
|
|
68
|
+
fetchPolicy?: FetchPolicy;
|
|
69
|
+
/**
|
|
70
|
+
* A unique identifier for the query. Each item in the array must be a stable identifier to prevent infinite fetches.
|
|
71
|
+
*
|
|
72
|
+
* This is useful when using the same query and variables combination in more than one component, otherwise the components may clobber each other. This can also be used to force the query to re-evaluate fresh.
|
|
73
|
+
*
|
|
74
|
+
* @docGroup
|
|
75
|
+
*
|
|
76
|
+
* 1. Operation options
|
|
77
|
+
*/
|
|
78
|
+
queryKey?: string | number | any[];
|
|
79
|
+
/**
|
|
80
|
+
* If `true`, the query is not executed. The default value is `false`.
|
|
81
|
+
*
|
|
82
|
+
* @deprecated
|
|
83
|
+
*
|
|
84
|
+
* We recommend using `skipToken` in place of the `skip` option as it is more type-safe.
|
|
85
|
+
*
|
|
86
|
+
* This option is deprecated and only supported to ease the migration from useQuery. It will be removed in a future release.
|
|
87
|
+
*
|
|
88
|
+
* @docGroup
|
|
89
|
+
*
|
|
90
|
+
* 1. Operation options
|
|
91
|
+
*
|
|
92
|
+
*
|
|
93
|
+
* @example Recommended usage of `skipToken`:
|
|
94
|
+
* ```ts
|
|
95
|
+
* import { skipToken, useBackgroundQuery } from '@apollo/client';
|
|
96
|
+
*
|
|
97
|
+
* const [queryRef] = useBackgroundQuery(query, id ? { variables: { id } } : skipToken);
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
skip?: boolean;
|
|
101
|
+
} & VariablesOption<TVariables>;
|
|
102
|
+
type Result<TData = unknown, TVariables extends OperationVariables = OperationVariables> = {
|
|
103
|
+
/**
|
|
104
|
+
* A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.
|
|
105
|
+
*
|
|
106
|
+
* This function returns _another_ function that you can call to terminate the subscription.
|
|
107
|
+
*/
|
|
108
|
+
subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
|
|
109
|
+
/**
|
|
110
|
+
* A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).
|
|
111
|
+
*/
|
|
112
|
+
fetchMore: FetchMoreFunction<TData, TVariables>;
|
|
113
|
+
/**
|
|
114
|
+
* Update the variables of this observable query, and fetch the new results. This method should be preferred over `setVariables` in most use cases.
|
|
115
|
+
*
|
|
116
|
+
* @param variables - The new set of variables. If there are missing variables, the previous values of those variables will be used.
|
|
117
|
+
*/
|
|
118
|
+
refetch: RefetchFunction<TData, TVariables>;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
|
|
122
|
+
/** @deprecated `returnPartialData` has no effect on `no-cache` queries */
|
|
123
|
+
returnPartialData: boolean;
|
|
124
|
+
fetchPolicy: "no-cache";
|
|
125
|
+
}): [
|
|
126
|
+
QueryRef<TData, TVariables, "complete" | "streaming">,
|
|
127
|
+
useBackgroundQuery.Result<TData, TVariables>
|
|
128
|
+
];
|
|
129
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
|
|
130
|
+
returnPartialData: false;
|
|
131
|
+
errorPolicy: "ignore" | "all";
|
|
132
|
+
}): [
|
|
133
|
+
QueryRef<TData, TVariables, "complete" | "streaming" | "empty">,
|
|
134
|
+
useBackgroundQuery.Result<TData, TVariables>
|
|
135
|
+
];
|
|
136
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
|
|
137
|
+
returnPartialData: boolean;
|
|
138
|
+
errorPolicy: "ignore" | "all";
|
|
139
|
+
}): [
|
|
140
|
+
QueryRef<TData, TVariables, "complete" | "streaming" | "partial" | "empty">,
|
|
141
|
+
useBackgroundQuery.Result<TData, TVariables>
|
|
142
|
+
];
|
|
143
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
|
|
144
|
+
errorPolicy: "ignore" | "all";
|
|
145
|
+
}): [
|
|
146
|
+
QueryRef<TData, TVariables, "complete" | "streaming" | "empty">,
|
|
147
|
+
useBackgroundQuery.Result<TData, TVariables>
|
|
148
|
+
];
|
|
149
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
|
|
150
|
+
skip: boolean;
|
|
151
|
+
returnPartialData: false;
|
|
152
|
+
}): [
|
|
153
|
+
QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
|
|
154
|
+
useBackgroundQuery.Result<TData, TVariables>
|
|
155
|
+
];
|
|
156
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
|
|
157
|
+
skip: boolean;
|
|
158
|
+
returnPartialData: boolean;
|
|
159
|
+
}): [
|
|
160
|
+
QueryRef<TData, TVariables, "complete" | "streaming" | "partial"> | undefined,
|
|
161
|
+
useBackgroundQuery.Result<TData, TVariables>
|
|
162
|
+
];
|
|
163
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
|
|
164
|
+
returnPartialData: false;
|
|
165
|
+
}): [
|
|
166
|
+
QueryRef<TData, TVariables, "complete" | "streaming">,
|
|
167
|
+
useBackgroundQuery.Result<TData, TVariables>
|
|
168
|
+
];
|
|
169
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
|
|
170
|
+
returnPartialData: boolean;
|
|
171
|
+
}): [
|
|
172
|
+
QueryRef<TData, TVariables, "complete" | "streaming" | "partial">,
|
|
173
|
+
useBackgroundQuery.Result<TData, TVariables>
|
|
174
|
+
];
|
|
175
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
|
|
176
|
+
skip: boolean;
|
|
177
|
+
}): [
|
|
178
|
+
QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
|
|
179
|
+
useBackgroundQuery.Result<TData, TVariables>
|
|
180
|
+
];
|
|
181
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken): [undefined, useBackgroundQuery.Result<TData, TVariables>];
|
|
182
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useBackgroundQuery.Options<NoInfer<TVariables>> & {
|
|
183
|
+
returnPartialData: false;
|
|
184
|
+
})): [
|
|
185
|
+
QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
|
|
186
|
+
useBackgroundQuery.Result<TData, TVariables>
|
|
187
|
+
];
|
|
188
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useBackgroundQuery.Options<NoInfer<TVariables>> & {
|
|
189
|
+
returnPartialData: boolean;
|
|
190
|
+
})): [
|
|
191
|
+
QueryRef<TData, TVariables, "complete" | "streaming" | "partial"> | undefined,
|
|
192
|
+
useBackgroundQuery.Result<TData, TVariables>
|
|
193
|
+
];
|
|
194
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
|
|
195
|
+
options?: useBackgroundQuery.Options<NoInfer<TVariables>>
|
|
196
|
+
] : [options: useBackgroundQuery.Options<NoInfer<TVariables>>]): [
|
|
197
|
+
QueryRef<TData, TVariables, "complete" | "streaming">,
|
|
198
|
+
useBackgroundQuery.Result<TData, TVariables>
|
|
199
|
+
];
|
|
200
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, ...[options]: {} extends TVariables ? [
|
|
201
|
+
options?: SkipToken | useBackgroundQuery.Options<NoInfer<TVariables>>
|
|
202
|
+
] : [options: SkipToken | useBackgroundQuery.Options<NoInfer<TVariables>>]): [
|
|
203
|
+
QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
|
|
204
|
+
useBackgroundQuery.Result<TData, TVariables>
|
|
205
|
+
];
|
|
206
|
+
export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | useBackgroundQuery.Options<NoInfer<TVariables>>): [
|
|
207
|
+
QueryRef<TData, TVariables, "complete" | "streaming"> | undefined,
|
|
208
|
+
useBackgroundQuery.Result<TData, TVariables>
|
|
209
|
+
];
|
|
210
|
+
//# sourceMappingURL=useBackgroundQuery.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { canonicalStringify } from "@apollo/client/cache";
|
|
3
|
+
import { getSuspenseCache, unwrapQueryRef, updateWrappedQueryRef, wrapQueryRef, } from "@apollo/client/react/internal";
|
|
4
|
+
import { wrapHook } from "./internal/index.js";
|
|
5
|
+
import { useApolloClient } from "./useApolloClient.js";
|
|
6
|
+
import { useWatchQueryOptions } from "./useSuspenseQuery.js";
|
|
7
|
+
export function useBackgroundQuery(query, options) {
|
|
8
|
+
"use no memo";
|
|
9
|
+
return wrapHook("useBackgroundQuery",
|
|
10
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
11
|
+
useBackgroundQuery_, useApolloClient(typeof options === "object" ? options.client : undefined))(query, options ?? {});
|
|
12
|
+
}
|
|
13
|
+
function useBackgroundQuery_(query, options) {
|
|
14
|
+
const client = useApolloClient(options.client);
|
|
15
|
+
const suspenseCache = getSuspenseCache(client);
|
|
16
|
+
const watchQueryOptions = useWatchQueryOptions({ client, query, options });
|
|
17
|
+
const { fetchPolicy, variables } = watchQueryOptions;
|
|
18
|
+
const { queryKey = [] } = options;
|
|
19
|
+
// This ref tracks the first time query execution is enabled to determine
|
|
20
|
+
// whether to return a query ref or `undefined`. When initialized
|
|
21
|
+
// in a skipped state (either via `skip: true` or `skipToken`) we return
|
|
22
|
+
// `undefined` for the `queryRef` until the query has been enabled. Once
|
|
23
|
+
// enabled, a query ref is always returned regardless of whether the query is
|
|
24
|
+
// skipped again later.
|
|
25
|
+
const didFetchResult = React.useRef(fetchPolicy !== "standby");
|
|
26
|
+
didFetchResult.current ||= fetchPolicy !== "standby";
|
|
27
|
+
const cacheKey = [
|
|
28
|
+
query,
|
|
29
|
+
canonicalStringify(variables),
|
|
30
|
+
...[].concat(queryKey),
|
|
31
|
+
];
|
|
32
|
+
const queryRef = suspenseCache.getQueryRef(cacheKey, () => client.watchQuery(watchQueryOptions));
|
|
33
|
+
const [wrappedQueryRef, setWrappedQueryRef] = React.useState(wrapQueryRef(queryRef));
|
|
34
|
+
if (unwrapQueryRef(wrappedQueryRef) !== queryRef) {
|
|
35
|
+
setWrappedQueryRef(wrapQueryRef(queryRef));
|
|
36
|
+
}
|
|
37
|
+
if (queryRef.didChangeOptions(watchQueryOptions)) {
|
|
38
|
+
const promise = queryRef.applyOptions(watchQueryOptions);
|
|
39
|
+
updateWrappedQueryRef(wrappedQueryRef, promise);
|
|
40
|
+
}
|
|
41
|
+
// This prevents issues where rerendering useBackgroundQuery after the
|
|
42
|
+
// queryRef has been disposed would cause the hook to return a new queryRef
|
|
43
|
+
// instance since disposal also removes it from the suspense cache. We add
|
|
44
|
+
// the queryRef back in the suspense cache so that the next render will reuse
|
|
45
|
+
// this queryRef rather than initializing a new instance.
|
|
46
|
+
React.useEffect(() => {
|
|
47
|
+
// Since the queryRef is disposed async via `setTimeout`, we have to wait a
|
|
48
|
+
// tick before checking it and adding back to the suspense cache.
|
|
49
|
+
const id = setTimeout(() => {
|
|
50
|
+
if (queryRef.disposed) {
|
|
51
|
+
suspenseCache.add(cacheKey, queryRef);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return () => clearTimeout(id);
|
|
55
|
+
// Omitting the deps is intentional. This avoids stale closures and the
|
|
56
|
+
// conditional ensures we aren't running the logic on each render.
|
|
57
|
+
});
|
|
58
|
+
const fetchMore = React.useCallback((options_0) => {
|
|
59
|
+
const promise_0 = queryRef.fetchMore(options_0);
|
|
60
|
+
setWrappedQueryRef(wrapQueryRef(queryRef));
|
|
61
|
+
return promise_0;
|
|
62
|
+
}, [queryRef]);
|
|
63
|
+
const refetch = React.useCallback((variables_0) => {
|
|
64
|
+
const promise_1 = queryRef.refetch(variables_0);
|
|
65
|
+
setWrappedQueryRef(wrapQueryRef(queryRef));
|
|
66
|
+
return promise_1;
|
|
67
|
+
}, [queryRef]);
|
|
68
|
+
React.useEffect(() => queryRef.softRetain(), [queryRef]);
|
|
69
|
+
return [
|
|
70
|
+
didFetchResult.current ? wrappedQueryRef : void 0,
|
|
71
|
+
{
|
|
72
|
+
fetchMore,
|
|
73
|
+
refetch,
|
|
74
|
+
// TODO: The internalQueryRef doesn't have TVariables' type information so we have to cast it here
|
|
75
|
+
subscribeToMore: queryRef.observable
|
|
76
|
+
.subscribeToMore,
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=useBackgroundQuery.js.map
|