@apollo/client 3.8.7 → 3.8.8
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/.changeset/README.md +8 -0
- package/.changeset/config.json +14 -0
- package/CHANGELOG.md +3357 -0
- package/apollo-client.cjs +314 -316
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +133 -152
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +133 -152
- package/cache/core/cache.d.ts +10 -0
- package/cache/core/cache.js +17 -5
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +1 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +92 -0
- package/cache/core/types/common.js +4 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +1 -1
- package/cache/inmemory/entityStore.js +190 -29
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fixPolyfills.js +9 -0
- package/cache/inmemory/fixPolyfills.js.map +1 -1
- package/cache/inmemory/fixPolyfills.native.js +12 -0
- package/cache/inmemory/fixPolyfills.native.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.js +23 -12
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.js +20 -11
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.js +161 -8
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +72 -4
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/object-canon.js +91 -3
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.js +193 -43
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.js +20 -2
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +4 -0
- package/cache/inmemory/readFromStore.js +54 -9
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +28 -0
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.js +152 -25
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/config/jest/setup.js +2 -0
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.d.ts +264 -3
- package/core/ApolloClient.js +235 -7
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +4 -6
- package/core/LocalState.js +56 -18
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +25 -0
- package/core/ObservableQuery.js +239 -30
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +3 -3
- package/core/QueryInfo.js +116 -13
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +4 -0
- package/core/QueryManager.js +229 -33
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +112 -103
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +112 -103
- package/core/equalByQuery.js +20 -1
- package/core/equalByQuery.js.map +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +19 -0
- package/core/index.js.map +1 -1
- package/core/networkStatus.d.ts +39 -0
- package/core/networkStatus.js +39 -0
- package/core/networkStatus.js.map +1 -1
- package/core/types.d.ts +9 -0
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +225 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +5 -111
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +5 -111
- package/dev/loadErrorMessageHandler.js.map +1 -1
- package/errors/errors.cjs +1 -1
- package/errors/errors.cjs.map +1 -1
- package/errors/errors.cjs.native.js +1 -1
- package/errors/index.js +14 -1
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +1 -0
- package/link/batch/batch.cjs +2 -2
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batch.cjs.native.js +2 -2
- package/link/batch/batchLink.d.ts +21 -0
- package/link/batch/batchLink.js +2 -1
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.js +24 -1
- package/link/batch/batching.js.map +1 -1
- package/link/batch-http/batch-http.cjs +3 -2
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +3 -2
- package/link/batch-http/batchHttpLink.d.ts +4 -0
- package/link/batch-http/batchHttpLink.js +53 -2
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/context/context.cjs.map +1 -1
- package/link/context/index.js +1 -0
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.js +12 -5
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs +5 -5
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +5 -5
- package/link/error/error.cjs +1 -1
- package/link/error/error.cjs.map +1 -1
- package/link/error/error.cjs.native.js +1 -1
- package/link/error/index.d.ts +3 -0
- package/link/error/index.js +4 -1
- package/link/error/index.js.map +1 -1
- package/link/http/HttpLink.d.ts +0 -2
- package/link/http/HttpLink.js +1 -1
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.js +23 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/createSignalIfSupported.d.ts +5 -0
- package/link/http/createSignalIfSupported.js +5 -0
- package/link/http/createSignalIfSupported.js.map +1 -1
- package/link/http/http.cjs +14 -12
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +14 -12
- package/link/http/index.js +2 -1
- package/link/http/index.js.map +1 -1
- package/link/http/iterators/async.d.ts +4 -0
- package/link/http/iterators/async.js +4 -0
- package/link/http/iterators/async.js.map +1 -1
- package/link/http/iterators/nodeStream.d.ts +4 -0
- package/link/http/iterators/nodeStream.js +4 -0
- package/link/http/iterators/nodeStream.js.map +1 -1
- package/link/http/iterators/promise.d.ts +4 -0
- package/link/http/iterators/promise.js +4 -0
- package/link/http/iterators/promise.js.map +1 -1
- package/link/http/iterators/reader.d.ts +4 -0
- package/link/http/iterators/reader.js +4 -0
- package/link/http/iterators/reader.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +51 -10
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/responseIterator.d.ts +4 -0
- package/link/http/responseIterator.js +6 -0
- package/link/http/responseIterator.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +1 -1
- package/link/http/rewriteURIForGET.js +10 -0
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +45 -0
- package/link/http/selectHttpOptionsAndBody.js +23 -0
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/selectURI.js.map +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.js +34 -4
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +4 -4
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +4 -4
- package/link/remove-typename/remove-typename.cjs +12 -9
- package/link/remove-typename/remove-typename.cjs.map +1 -1
- package/link/remove-typename/remove-typename.cjs.native.js +12 -9
- package/link/remove-typename/removeTypenameFromVariables.js +12 -9
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/link/retry/delayFunction.d.ts +29 -0
- package/link/retry/delayFunction.js +6 -0
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/retry.cjs +5 -5
- package/link/retry/retry.cjs.map +1 -1
- package/link/retry/retry.cjs.native.js +5 -5
- package/link/retry/retryFunction.d.ts +20 -0
- package/link/retry/retryLink.d.ts +6 -0
- package/link/retry/retryLink.js +31 -6
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +13 -0
- package/link/schema/index.js +3 -3
- package/link/schema/index.js.map +1 -1
- package/link/schema/schema.cjs +3 -3
- package/link/schema/schema.cjs.map +1 -1
- package/link/schema/schema.cjs.native.js +3 -3
- package/link/subscriptions/index.js +35 -2
- package/link/subscriptions/index.js.map +1 -1
- package/link/subscriptions/subscriptions.cjs +3 -2
- package/link/subscriptions/subscriptions.cjs.map +1 -1
- package/link/subscriptions/subscriptions.cjs.native.js +3 -2
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/filterOperationVariables.js +4 -0
- package/link/utils/filterOperationVariables.js.map +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/transformOperation.js +3 -2
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/utils.cjs +2 -2
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +2 -2
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +12 -0
- package/link/ws/index.js +1 -1
- package/link/ws/index.js.map +1 -1
- package/link/ws/ws.cjs +1 -1
- package/link/ws/ws.cjs.map +1 -1
- package/link/ws/ws.cjs.native.js +1 -1
- package/package.json +49 -38
- package/react/cache/QueryReference.d.ts +6 -1
- package/react/cache/QueryReference.js +26 -1
- package/react/cache/QueryReference.js.map +1 -1
- package/react/cache/SuspenseCache.d.ts +10 -0
- package/react/cache/SuspenseCache.js +1 -1
- package/react/cache/SuspenseCache.js.map +1 -1
- package/react/cache/getSuspenseCache.js.map +1 -1
- package/react/context/ApolloContext.d.ts +5 -0
- package/react/context/ApolloContext.js +10 -3
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/context.cjs +1 -3
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +1 -3
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.js +3 -1
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/hoc.cjs +9 -17
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +9 -17
- package/react/hoc/mutation-hoc.js +9 -4
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.js +10 -4
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.js +10 -4
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/withApollo.js +3 -4
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs +30 -22
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +30 -22
- package/react/hooks/internal/__use.js +5 -0
- package/react/hooks/internal/__use.js.map +1 -1
- package/react/hooks/internal/index.js +1 -0
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/internal/useDeepMemo.js.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +6 -3
- package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
- package/react/hooks/useBackgroundQuery.js +6 -0
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.js +4 -3
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.js +13 -4
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.js +8 -3
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +11 -0
- package/react/hooks/useQuery.js +137 -5
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReactiveVar.js +5 -0
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +19 -0
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.js +5 -0
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +11 -5
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +53 -1
- package/react/hooks/useSyncExternalStore.js.map +1 -1
- package/react/parser/index.js +4 -5
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +2 -4
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +2 -4
- package/react/ssr/RenderPromises.js +21 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/getDataFromTree.js +18 -3
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/ssr.cjs +6 -4
- package/react/ssr/ssr.cjs.map +1 -1
- package/react/ssr/ssr.cjs.native.js +6 -4
- package/react/types/types.d.ts +66 -0
- package/testing/core/core.cjs +14 -11
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +14 -11
- package/testing/core/itAsync.d.ts +1 -1
- package/testing/core/itAsync.js.map +1 -1
- package/testing/core/mocking/mockFetch.d.ts +2 -2
- package/testing/core/mocking/mockFetch.js +8 -4
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockLink.js +17 -7
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.js +2 -0
- package/testing/core/mocking/mockQueryManager.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/mocking/mockWatchQuery.js +1 -1
- package/testing/core/mocking/mockWatchQuery.js.map +1 -1
- package/testing/core/observableToPromise.d.ts +17 -3
- package/testing/core/observableToPromise.js +5 -0
- package/testing/core/observableToPromise.js.map +1 -1
- package/testing/core/subscribeAndCount.js +3 -0
- package/testing/core/subscribeAndCount.js.map +1 -1
- package/testing/core/wait.js +2 -2
- package/testing/core/wait.js.map +1 -1
- package/testing/core/withConsoleSpy.d.ts +3 -0
- package/testing/core/withConsoleSpy.js +7 -1
- package/testing/core/withConsoleSpy.js.map +1 -1
- package/testing/core/wrap.js +2 -0
- package/testing/core/wrap.js.map +1 -1
- package/testing/internal/ObservableStream.js +14 -14
- package/testing/internal/ObservableStream.js.map +1 -1
- package/testing/internal/disposables/spyOnConsole.d.ts +1 -0
- package/testing/internal/disposables/spyOnConsole.js +2 -0
- package/testing/internal/disposables/spyOnConsole.js.map +1 -1
- package/testing/internal/disposables/withCleanup.d.ts +1 -0
- package/testing/internal/disposables/withCleanup.js +3 -0
- package/testing/internal/disposables/withCleanup.js.map +1 -1
- package/testing/internal/profile/Render.d.ts +28 -0
- package/testing/internal/profile/Render.js +12 -1
- package/testing/internal/profile/Render.js.map +1 -1
- package/testing/internal/profile/profile.d.ts +44 -7
- package/testing/internal/profile/profile.js +63 -51
- package/testing/internal/profile/profile.js.map +1 -1
- package/testing/internal/profile/traces.d.ts +4 -0
- package/testing/internal/profile/traces.js +9 -5
- package/testing/internal/profile/traces.js.map +1 -1
- package/testing/matchers/ProfiledComponent.js +27 -22
- package/testing/matchers/ProfiledComponent.js.map +1 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +1 -1
- package/testing/matchers/toMatchDocument.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +4 -0
- package/testing/react/MockedProvider.js +6 -2
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +4 -2
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +4 -2
- package/utilities/common/arrays.js +1 -0
- package/utilities/common/arrays.js.map +1 -1
- package/utilities/common/canUse.js +16 -1
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/cloneDeep.d.ts +3 -0
- package/utilities/common/cloneDeep.js +5 -0
- package/utilities/common/cloneDeep.js.map +1 -1
- package/utilities/common/compact.d.ts +4 -0
- package/utilities/common/compact.js +4 -0
- package/utilities/common/compact.js.map +1 -1
- package/utilities/common/errorHandling.js +1 -3
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/incrementalResult.js +3 -0
- package/utilities/common/incrementalResult.js.map +1 -1
- package/utilities/common/makeUniqueId.js +2 -0
- package/utilities/common/makeUniqueId.js.map +1 -1
- package/utilities/common/maybeDeepFreeze.js +3 -0
- package/utilities/common/maybeDeepFreeze.js.map +1 -1
- package/utilities/common/mergeDeep.js +12 -1
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/common/omitDeep.js.map +1 -1
- package/utilities/globals/global.js +7 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/globals.cjs +4 -5
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +4 -5
- package/utilities/globals/index.d.ts +4 -0
- package/utilities/globals/index.js +7 -0
- package/utilities/globals/index.js.map +1 -1
- package/utilities/globals/invariantWrappers.d.ts +40 -0
- package/utilities/globals/invariantWrappers.js +11 -3
- package/utilities/globals/invariantWrappers.js.map +1 -1
- package/utilities/globals/maybe.js.map +1 -1
- package/utilities/graphql/DocumentTransform.js +19 -6
- package/utilities/graphql/DocumentTransform.js.map +1 -1
- package/utilities/graphql/directives.js +3 -0
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts +25 -0
- package/utilities/graphql/fragments.js +36 -0
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts +5 -0
- package/utilities/graphql/getFromAST.js +9 -0
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/print.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +14 -0
- package/utilities/graphql/storeUtils.js +7 -2
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.js +106 -7
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/observables/Concast.d.ts +1 -1
- package/utilities/observables/Concast.js +84 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/Observable.js +6 -0
- package/utilities/observables/Observable.js.map +1 -1
- package/utilities/observables/asyncMap.js +12 -3
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/observables/iteration.js +3 -0
- package/utilities/observables/iteration.js.map +1 -1
- package/utilities/observables/subclassing.js +14 -0
- package/utilities/observables/subclassing.js.map +1 -1
- package/utilities/policies/pagination.js +47 -3
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/promises/decoration.js +1 -0
- package/utilities/promises/decoration.js.map +1 -1
- package/utilities/types/DeepOmit.js.map +1 -1
- package/utilities/types/DeepPartial.d.ts +1 -1
- package/utilities/types/DeepPartial.js +4 -0
- package/utilities/types/DeepPartial.js.map +1 -1
- package/utilities/types/IsStrictlyAny.js.map +1 -1
- package/utilities/types/TODO.d.ts +3 -0
- package/utilities/types/TODO.js +2 -0
- package/utilities/types/TODO.js.map +1 -0
- package/utilities/utilities.cjs +31 -27
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +31 -27
- package/version.js +1 -1
- package/cache/core/cache.d.ts.map +0 -1
- package/cache/core/types/Cache.d.ts.map +0 -1
- package/cache/core/types/DataProxy.d.ts.map +0 -1
- package/cache/core/types/common.d.ts.map +0 -1
- package/cache/index.d.ts.map +0 -1
- package/cache/inmemory/entityStore.d.ts.map +0 -1
- package/cache/inmemory/fixPolyfills.d.ts.map +0 -1
- package/cache/inmemory/fixPolyfills.native.d.ts.map +0 -1
- package/cache/inmemory/fragmentRegistry.d.ts.map +0 -1
- package/cache/inmemory/helpers.d.ts.map +0 -1
- package/cache/inmemory/inMemoryCache.d.ts.map +0 -1
- package/cache/inmemory/key-extractor.d.ts.map +0 -1
- package/cache/inmemory/object-canon.d.ts.map +0 -1
- package/cache/inmemory/policies.d.ts.map +0 -1
- package/cache/inmemory/reactiveVars.d.ts.map +0 -1
- package/cache/inmemory/readFromStore.d.ts.map +0 -1
- package/cache/inmemory/types.d.ts.map +0 -1
- package/cache/inmemory/writeToStore.d.ts.map +0 -1
- package/config/jest/setup.d.ts.map +0 -1
- package/core/ApolloClient.d.ts.map +0 -1
- package/core/LocalState.d.ts.map +0 -1
- package/core/ObservableQuery.d.ts.map +0 -1
- package/core/QueryInfo.d.ts.map +0 -1
- package/core/QueryManager.d.ts.map +0 -1
- package/core/equalByQuery.d.ts.map +0 -1
- package/core/index.d.ts.map +0 -1
- package/core/networkStatus.d.ts.map +0 -1
- package/core/types.d.ts.map +0 -1
- package/core/watchQueryOptions.d.ts.map +0 -1
- package/dev/index.d.ts.map +0 -1
- package/dev/loadDevMessages.d.ts.map +0 -1
- package/dev/loadErrorMessageHandler.d.ts.map +0 -1
- package/dev/loadErrorMessages.d.ts.map +0 -1
- package/errors/index.d.ts.map +0 -1
- package/index.d.ts.map +0 -1
- package/invariantErrorCodes.d.ts.map +0 -1
- package/link/batch/batchLink.d.ts.map +0 -1
- package/link/batch/batching.d.ts.map +0 -1
- package/link/batch/index.d.ts.map +0 -1
- package/link/batch-http/batchHttpLink.d.ts.map +0 -1
- package/link/batch-http/index.d.ts.map +0 -1
- package/link/context/index.d.ts.map +0 -1
- package/link/core/ApolloLink.d.ts.map +0 -1
- package/link/core/concat.d.ts.map +0 -1
- package/link/core/empty.d.ts.map +0 -1
- package/link/core/execute.d.ts.map +0 -1
- package/link/core/from.d.ts.map +0 -1
- package/link/core/index.d.ts.map +0 -1
- package/link/core/split.d.ts.map +0 -1
- package/link/core/types.d.ts.map +0 -1
- package/link/error/index.d.ts.map +0 -1
- package/link/http/HttpLink.d.ts.map +0 -1
- package/link/http/checkFetcher.d.ts.map +0 -1
- package/link/http/createHttpLink.d.ts.map +0 -1
- package/link/http/createSignalIfSupported.d.ts.map +0 -1
- package/link/http/index.d.ts.map +0 -1
- package/link/http/iterators/async.d.ts.map +0 -1
- package/link/http/iterators/nodeStream.d.ts.map +0 -1
- package/link/http/iterators/promise.d.ts.map +0 -1
- package/link/http/iterators/reader.d.ts.map +0 -1
- package/link/http/parseAndCheckHttpResponse.d.ts.map +0 -1
- package/link/http/responseIterator.d.ts.map +0 -1
- package/link/http/rewriteURIForGET.d.ts.map +0 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +0 -1
- package/link/http/selectURI.d.ts.map +0 -1
- package/link/http/serializeFetchParameter.d.ts.map +0 -1
- package/link/persisted-queries/index.d.ts.map +0 -1
- package/link/remove-typename/index.d.ts.map +0 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts.map +0 -1
- package/link/retry/delayFunction.d.ts.map +0 -1
- package/link/retry/index.d.ts.map +0 -1
- package/link/retry/retryFunction.d.ts.map +0 -1
- package/link/retry/retryLink.d.ts.map +0 -1
- package/link/schema/index.d.ts.map +0 -1
- package/link/subscriptions/index.d.ts.map +0 -1
- package/link/utils/createOperation.d.ts.map +0 -1
- package/link/utils/filterOperationVariables.d.ts.map +0 -1
- package/link/utils/fromError.d.ts.map +0 -1
- package/link/utils/fromPromise.d.ts.map +0 -1
- package/link/utils/index.d.ts.map +0 -1
- package/link/utils/throwServerError.d.ts.map +0 -1
- package/link/utils/toPromise.d.ts.map +0 -1
- package/link/utils/transformOperation.d.ts.map +0 -1
- package/link/utils/validateOperation.d.ts.map +0 -1
- package/link/ws/index.d.ts.map +0 -1
- package/react/cache/QueryReference.d.ts.map +0 -1
- package/react/cache/SuspenseCache.d.ts.map +0 -1
- package/react/cache/getSuspenseCache.d.ts.map +0 -1
- package/react/cache/index.d.ts.map +0 -1
- package/react/cache/types.d.ts.map +0 -1
- package/react/components/Mutation.d.ts.map +0 -1
- package/react/components/Query.d.ts.map +0 -1
- package/react/components/Subscription.d.ts.map +0 -1
- package/react/components/index.d.ts.map +0 -1
- package/react/components/types.d.ts.map +0 -1
- package/react/context/ApolloConsumer.d.ts.map +0 -1
- package/react/context/ApolloContext.d.ts.map +0 -1
- package/react/context/ApolloProvider.d.ts.map +0 -1
- package/react/context/index.d.ts.map +0 -1
- package/react/hoc/graphql.d.ts.map +0 -1
- package/react/hoc/hoc-utils.d.ts.map +0 -1
- package/react/hoc/index.d.ts.map +0 -1
- package/react/hoc/mutation-hoc.d.ts.map +0 -1
- package/react/hoc/query-hoc.d.ts.map +0 -1
- package/react/hoc/subscription-hoc.d.ts.map +0 -1
- package/react/hoc/types.d.ts.map +0 -1
- package/react/hoc/withApollo.d.ts.map +0 -1
- package/react/hooks/constants.d.ts.map +0 -1
- package/react/hooks/index.d.ts.map +0 -1
- package/react/hooks/internal/__use.d.ts.map +0 -1
- package/react/hooks/internal/index.d.ts.map +0 -1
- package/react/hooks/internal/useDeepMemo.d.ts.map +0 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +0 -1
- package/react/hooks/useApolloClient.d.ts.map +0 -1
- package/react/hooks/useBackgroundQuery.d.ts.map +0 -1
- package/react/hooks/useFragment.d.ts.map +0 -1
- package/react/hooks/useLazyQuery.d.ts.map +0 -1
- package/react/hooks/useMutation.d.ts.map +0 -1
- package/react/hooks/useQuery.d.ts.map +0 -1
- package/react/hooks/useReactiveVar.d.ts.map +0 -1
- package/react/hooks/useReadQuery.d.ts.map +0 -1
- package/react/hooks/useSubscription.d.ts.map +0 -1
- package/react/hooks/useSuspenseQuery.d.ts.map +0 -1
- package/react/hooks/useSyncExternalStore.d.ts.map +0 -1
- package/react/index.d.ts.map +0 -1
- package/react/parser/index.d.ts.map +0 -1
- package/react/ssr/RenderPromises.d.ts.map +0 -1
- package/react/ssr/getDataFromTree.d.ts.map +0 -1
- package/react/ssr/index.d.ts.map +0 -1
- package/react/ssr/renderToStringWithData.d.ts.map +0 -1
- package/react/types/types.d.ts.map +0 -1
- package/testing/core/index.d.ts.map +0 -1
- package/testing/core/itAsync.d.ts.map +0 -1
- package/testing/core/mocking/mockClient.d.ts.map +0 -1
- package/testing/core/mocking/mockFetch.d.ts.map +0 -1
- package/testing/core/mocking/mockLink.d.ts.map +0 -1
- package/testing/core/mocking/mockQueryManager.d.ts.map +0 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +0 -1
- package/testing/core/mocking/mockWatchQuery.d.ts.map +0 -1
- package/testing/core/observableToPromise.d.ts.map +0 -1
- package/testing/core/subscribeAndCount.d.ts.map +0 -1
- package/testing/core/wait.d.ts.map +0 -1
- package/testing/core/withConsoleSpy.d.ts.map +0 -1
- package/testing/core/wrap.d.ts.map +0 -1
- package/testing/index.d.ts.map +0 -1
- package/testing/internal/ObservableStream.d.ts.map +0 -1
- package/testing/internal/disposables/index.d.ts.map +0 -1
- package/testing/internal/disposables/spyOnConsole.d.ts.map +0 -1
- package/testing/internal/disposables/withCleanup.d.ts.map +0 -1
- package/testing/internal/index.d.ts.map +0 -1
- package/testing/internal/profile/Render.d.ts.map +0 -1
- package/testing/internal/profile/index.d.ts.map +0 -1
- package/testing/internal/profile/profile.d.ts.map +0 -1
- package/testing/internal/profile/traces.d.ts.map +0 -1
- package/testing/matchers/ProfiledComponent.d.ts.map +0 -1
- package/testing/matchers/index.d.ts.map +0 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts.map +0 -1
- package/testing/matchers/toMatchDocument.d.ts.map +0 -1
- package/testing/react/MockedProvider.d.ts.map +0 -1
- package/utilities/common/arrays.d.ts.map +0 -1
- package/utilities/common/canUse.d.ts.map +0 -1
- package/utilities/common/cloneDeep.d.ts.map +0 -1
- package/utilities/common/compact.d.ts.map +0 -1
- package/utilities/common/errorHandling.d.ts.map +0 -1
- package/utilities/common/filterInPlace.d.ts +0 -2
- package/utilities/common/filterInPlace.d.ts.map +0 -1
- package/utilities/common/filterInPlace.js +0 -11
- package/utilities/common/filterInPlace.js.map +0 -1
- package/utilities/common/incrementalResult.d.ts.map +0 -1
- package/utilities/common/makeUniqueId.d.ts.map +0 -1
- package/utilities/common/maybeDeepFreeze.d.ts.map +0 -1
- package/utilities/common/mergeDeep.d.ts.map +0 -1
- package/utilities/common/mergeOptions.d.ts.map +0 -1
- package/utilities/common/objects.d.ts.map +0 -1
- package/utilities/common/omitDeep.d.ts.map +0 -1
- package/utilities/common/stringifyForDisplay.d.ts.map +0 -1
- package/utilities/common/stripTypename.d.ts.map +0 -1
- package/utilities/globals/global.d.ts.map +0 -1
- package/utilities/globals/index.d.ts.map +0 -1
- package/utilities/globals/invariantWrappers.d.ts.map +0 -1
- package/utilities/globals/maybe.d.ts.map +0 -1
- package/utilities/graphql/DocumentTransform.d.ts.map +0 -1
- package/utilities/graphql/directives.d.ts.map +0 -1
- package/utilities/graphql/fragments.d.ts.map +0 -1
- package/utilities/graphql/getFromAST.d.ts.map +0 -1
- package/utilities/graphql/operations.d.ts.map +0 -1
- package/utilities/graphql/print.d.ts.map +0 -1
- package/utilities/graphql/storeUtils.d.ts.map +0 -1
- package/utilities/graphql/transform.d.ts.map +0 -1
- package/utilities/index.d.ts.map +0 -1
- package/utilities/observables/Concast.d.ts.map +0 -1
- package/utilities/observables/Observable.d.ts.map +0 -1
- package/utilities/observables/asyncMap.d.ts.map +0 -1
- package/utilities/observables/iteration.d.ts.map +0 -1
- package/utilities/observables/subclassing.d.ts.map +0 -1
- package/utilities/policies/pagination.d.ts.map +0 -1
- package/utilities/promises/decoration.d.ts.map +0 -1
- package/utilities/types/DeepOmit.d.ts.map +0 -1
- package/utilities/types/DeepPartial.d.ts.map +0 -1
- package/utilities/types/IsStrictlyAny.d.ts.map +0 -1
- package/utilities/types/Primitive.d.ts.map +0 -1
- package/version.d.ts.map +0 -1
package/core/QueryManager.js
CHANGED
|
@@ -14,19 +14,29 @@ import { QueryInfo, shouldWriteResult, } from "./QueryInfo.js";
|
|
|
14
14
|
import { PROTOCOL_ERRORS_SYMBOL } from "../errors/index.js";
|
|
15
15
|
import { print } from "../utilities/index.js";
|
|
16
16
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
17
|
-
var QueryManager = (function () {
|
|
17
|
+
var QueryManager = /** @class */ (function () {
|
|
18
18
|
function QueryManager(_a) {
|
|
19
|
-
var _this = this;
|
|
20
19
|
var cache = _a.cache, link = _a.link, defaultOptions = _a.defaultOptions, documentTransform = _a.documentTransform, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, _e = _a.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? !!cache.assumeImmutableResults : _e;
|
|
20
|
+
var _this = this;
|
|
21
21
|
this.clientAwareness = {};
|
|
22
|
+
// All the queries that the QueryManager is currently managing (not
|
|
23
|
+
// including mutations and subscriptions).
|
|
22
24
|
this.queries = new Map();
|
|
25
|
+
// Maps from queryId strings to Promise rejection functions for
|
|
26
|
+
// currently active queries and fetches.
|
|
27
|
+
// Use protected instead of private field so
|
|
28
|
+
// @apollo/experimental-nextjs-app-support can access type info.
|
|
23
29
|
this.fetchCancelFns = new Map();
|
|
24
30
|
this.transformCache = new (canUseWeakMap ? WeakMap : Map)();
|
|
25
31
|
this.queryIdCounter = 1;
|
|
26
32
|
this.requestIdCounter = 1;
|
|
27
33
|
this.mutationIdCounter = 1;
|
|
34
|
+
// Use protected instead of private field so
|
|
35
|
+
// @apollo/experimental-nextjs-app-support can access type info.
|
|
28
36
|
this.inFlightLinkObservables = new Map();
|
|
29
|
-
var defaultDocumentTransform = new DocumentTransform(function (document) { return _this.cache.transformDocument(document); },
|
|
37
|
+
var defaultDocumentTransform = new DocumentTransform(function (document) { return _this.cache.transformDocument(document); },
|
|
38
|
+
// Allow the apollo cache to manage its own transform caches
|
|
39
|
+
{ cache: false });
|
|
30
40
|
this.cache = cache;
|
|
31
41
|
this.link = link;
|
|
32
42
|
this.defaultOptions = defaultOptions || Object.create(null);
|
|
@@ -35,15 +45,24 @@ var QueryManager = (function () {
|
|
|
35
45
|
this.localState = localState || new LocalState({ cache: cache });
|
|
36
46
|
this.ssrMode = ssrMode;
|
|
37
47
|
this.assumeImmutableResults = assumeImmutableResults;
|
|
38
|
-
this.documentTransform =
|
|
39
|
-
?
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
this.documentTransform =
|
|
49
|
+
documentTransform ?
|
|
50
|
+
defaultDocumentTransform
|
|
51
|
+
.concat(documentTransform)
|
|
52
|
+
// The custom document transform may add new fragment spreads or new
|
|
53
|
+
// field selections, so we want to give the cache a chance to run
|
|
54
|
+
// again. For example, the InMemoryCache adds __typename to field
|
|
55
|
+
// selections and fragments from the fragment registry.
|
|
56
|
+
.concat(defaultDocumentTransform)
|
|
57
|
+
: defaultDocumentTransform;
|
|
43
58
|
if ((this.onBroadcast = onBroadcast)) {
|
|
44
59
|
this.mutationStore = Object.create(null);
|
|
45
60
|
}
|
|
46
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Call this method to terminate any active query processes, making it safe
|
|
64
|
+
* to dispose of this QueryManager instance.
|
|
65
|
+
*/
|
|
47
66
|
QueryManager.prototype.stop = function () {
|
|
48
67
|
var _this = this;
|
|
49
68
|
this.queries.forEach(function (_info, queryId) {
|
|
@@ -69,8 +88,8 @@ var QueryManager = (function () {
|
|
|
69
88
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
70
89
|
hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
|
|
71
90
|
variables = this.getVariables(mutation, variables);
|
|
72
|
-
if (!hasClientExports) return [3
|
|
73
|
-
return [4
|
|
91
|
+
if (!hasClientExports) return [3 /*break*/, 2];
|
|
92
|
+
return [4 /*yield*/, this.localState.addExportedVariables(mutation, variables, context)];
|
|
74
93
|
case 1:
|
|
75
94
|
variables = (_h.sent());
|
|
76
95
|
_h.label = 2;
|
|
@@ -97,7 +116,7 @@ var QueryManager = (function () {
|
|
|
97
116
|
}
|
|
98
117
|
this.broadcastQueries();
|
|
99
118
|
self = this;
|
|
100
|
-
return [2
|
|
119
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
101
120
|
return asyncMap(self.getObservableFromLink(mutation, __assign(__assign({}, context), { optimisticResponse: optimisticResponse }), variables, false), function (result) {
|
|
102
121
|
if (graphQLResultHasError(result) && errorPolicy === "none") {
|
|
103
122
|
throw new ApolloError({
|
|
@@ -134,6 +153,11 @@ var QueryManager = (function () {
|
|
|
134
153
|
}).subscribe({
|
|
135
154
|
next: function (storeResult) {
|
|
136
155
|
self.broadcastQueries();
|
|
156
|
+
// Since mutations might receive multiple payloads from the
|
|
157
|
+
// ApolloLink chain (e.g. when used with @defer),
|
|
158
|
+
// we resolve with a SingleExecutionResult or after the final
|
|
159
|
+
// ExecutionPatchResult has arrived and we have assembled the
|
|
160
|
+
// multipart response into a single result.
|
|
137
161
|
if (!("hasNext" in storeResult) || storeResult.hasNext === false) {
|
|
138
162
|
resolve(storeResult);
|
|
139
163
|
}
|
|
@@ -147,11 +171,9 @@ var QueryManager = (function () {
|
|
|
147
171
|
self.cache.removeOptimistic(mutationId);
|
|
148
172
|
}
|
|
149
173
|
self.broadcastQueries();
|
|
150
|
-
reject(err instanceof ApolloError
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
networkError: err,
|
|
154
|
-
}));
|
|
174
|
+
reject(err instanceof ApolloError ? err : (new ApolloError({
|
|
175
|
+
networkError: err,
|
|
176
|
+
})));
|
|
155
177
|
},
|
|
156
178
|
});
|
|
157
179
|
})];
|
|
@@ -178,6 +200,9 @@ var QueryManager = (function () {
|
|
|
178
200
|
isNonEmptyArray(result.incremental)) {
|
|
179
201
|
var diff = cache.diff({
|
|
180
202
|
id: "ROOT_MUTATION",
|
|
203
|
+
// The cache complains if passed a mutation where it expects a
|
|
204
|
+
// query, so we transform mutations and subscriptions to queries
|
|
205
|
+
// (only once, thanks to this.transformCache).
|
|
181
206
|
query: this.getDocumentInfo(mutation.document).asQuery,
|
|
182
207
|
variables: mutation.variables,
|
|
183
208
|
optimistic: false,
|
|
@@ -188,6 +213,8 @@ var QueryManager = (function () {
|
|
|
188
213
|
mergedData = mergeIncrementalData(diff.result, result);
|
|
189
214
|
}
|
|
190
215
|
if (typeof mergedData !== "undefined") {
|
|
216
|
+
// cast the ExecutionPatchResult to FetchResult here since
|
|
217
|
+
// ExecutionPatchResult never has `data` when returned from the server
|
|
191
218
|
result.data = mergedData;
|
|
192
219
|
cacheWrites.push({
|
|
193
220
|
result: mergedData,
|
|
@@ -207,6 +234,7 @@ var QueryManager = (function () {
|
|
|
207
234
|
}
|
|
208
235
|
var updater = updateQueries_1[queryName];
|
|
209
236
|
var _b = _this.queries.get(queryId), document = _b.document, variables = _b.variables;
|
|
237
|
+
// Read the current query result from the store.
|
|
210
238
|
var _c = cache.diff({
|
|
211
239
|
query: document,
|
|
212
240
|
variables: variables,
|
|
@@ -214,11 +242,13 @@ var QueryManager = (function () {
|
|
|
214
242
|
optimistic: false,
|
|
215
243
|
}), currentQueryResult = _c.result, complete = _c.complete;
|
|
216
244
|
if (complete && currentQueryResult) {
|
|
245
|
+
// Run our reducer using the current query result and the mutation result.
|
|
217
246
|
var nextQueryResult = updater(currentQueryResult, {
|
|
218
247
|
mutationResult: result,
|
|
219
248
|
queryName: (document && getOperationName(document)) || void 0,
|
|
220
249
|
queryVariables: variables,
|
|
221
250
|
});
|
|
251
|
+
// Write the modified result back into the store if we got a new result.
|
|
222
252
|
if (nextQueryResult) {
|
|
223
253
|
cacheWrites.push({
|
|
224
254
|
result: nextQueryResult,
|
|
@@ -242,13 +272,25 @@ var QueryManager = (function () {
|
|
|
242
272
|
if (!skipCache) {
|
|
243
273
|
cacheWrites.forEach(function (write) { return cache.write(write); });
|
|
244
274
|
}
|
|
275
|
+
// If the mutation has some writes associated with it then we need to
|
|
276
|
+
// apply those writes to the store by running this reducer again with
|
|
277
|
+
// a write action.
|
|
245
278
|
var update = mutation.update;
|
|
279
|
+
// Determine whether result is a SingleExecutionResult,
|
|
280
|
+
// or the final ExecutionPatchResult.
|
|
246
281
|
var isFinalResult = !isExecutionPatchResult(result) ||
|
|
247
282
|
(isExecutionPatchIncrementalResult(result) && !result.hasNext);
|
|
248
283
|
if (update) {
|
|
249
284
|
if (!skipCache) {
|
|
285
|
+
// Re-read the ROOT_MUTATION data we just wrote into the cache
|
|
286
|
+
// (the first cache.write call in the cacheWrites.forEach loop
|
|
287
|
+
// above), so field read functions have a chance to run for
|
|
288
|
+
// fields within mutation result objects.
|
|
250
289
|
var diff = cache.diff({
|
|
251
290
|
id: "ROOT_MUTATION",
|
|
291
|
+
// The cache complains if passed a mutation where it expects a
|
|
292
|
+
// query, so we transform mutations and subscriptions to queries
|
|
293
|
+
// (only once, thanks to this.transformCache).
|
|
252
294
|
query: _this.getDocumentInfo(mutation.document).asQuery,
|
|
253
295
|
variables: mutation.variables,
|
|
254
296
|
optimistic: false,
|
|
@@ -264,6 +306,9 @@ var QueryManager = (function () {
|
|
|
264
306
|
}
|
|
265
307
|
}
|
|
266
308
|
}
|
|
309
|
+
// If we've received the whole response,
|
|
310
|
+
// either a SingleExecutionResult or the final ExecutionPatchResult,
|
|
311
|
+
// call the update function.
|
|
267
312
|
if (isFinalResult) {
|
|
268
313
|
update(cache, result, {
|
|
269
314
|
context: mutation.context,
|
|
@@ -271,6 +316,8 @@ var QueryManager = (function () {
|
|
|
271
316
|
});
|
|
272
317
|
}
|
|
273
318
|
}
|
|
319
|
+
// TODO Do this with cache.evict({ id: 'ROOT_MUTATION' }) but make it
|
|
320
|
+
// shallow to allow rolling back optimistic evictions.
|
|
274
321
|
if (!skipCache && !mutation.keepRootFields && isFinalResult) {
|
|
275
322
|
cache.modify({
|
|
276
323
|
id: "ROOT_MUTATION",
|
|
@@ -282,11 +329,21 @@ var QueryManager = (function () {
|
|
|
282
329
|
}
|
|
283
330
|
},
|
|
284
331
|
include: mutation.refetchQueries,
|
|
332
|
+
// Write the final mutation.result to the root layer of the cache.
|
|
285
333
|
optimistic: false,
|
|
334
|
+
// Remove the corresponding optimistic layer at the same time as we
|
|
335
|
+
// write the final non-optimistic result.
|
|
286
336
|
removeOptimistic: mutation.removeOptimistic,
|
|
337
|
+
// Let the caller of client.mutate optionally determine the refetching
|
|
338
|
+
// behavior for watched queries after the mutation.update function runs.
|
|
339
|
+
// If no onQueryUpdated function was provided for this mutation, pass
|
|
340
|
+
// null instead of undefined to disable the default refetching behavior.
|
|
287
341
|
onQueryUpdated: mutation.onQueryUpdated || null,
|
|
288
342
|
}).forEach(function (result) { return results_1.push(result); });
|
|
289
343
|
if (mutation.awaitRefetchQueries || mutation.onQueryUpdated) {
|
|
344
|
+
// Returning a promise here makes the mutation await that promise, so we
|
|
345
|
+
// include results in that promise's work if awaitRefetchQueries or an
|
|
346
|
+
// onQueryUpdated function was specified.
|
|
290
347
|
return Promise.all(results_1).then(function () { return result; });
|
|
291
348
|
}
|
|
292
349
|
}
|
|
@@ -294,8 +351,8 @@ var QueryManager = (function () {
|
|
|
294
351
|
};
|
|
295
352
|
QueryManager.prototype.markMutationOptimistic = function (optimisticResponse, mutation) {
|
|
296
353
|
var _this = this;
|
|
297
|
-
var data = typeof optimisticResponse === "function"
|
|
298
|
-
|
|
354
|
+
var data = typeof optimisticResponse === "function" ?
|
|
355
|
+
optimisticResponse(mutation.variables)
|
|
299
356
|
: optimisticResponse;
|
|
300
357
|
return this.cache.recordOptimisticTransaction(function (cache) {
|
|
301
358
|
try {
|
|
@@ -336,6 +393,11 @@ var QueryManager = (function () {
|
|
|
336
393
|
var transformCache = this.transformCache;
|
|
337
394
|
if (!transformCache.has(document)) {
|
|
338
395
|
var cacheEntry = {
|
|
396
|
+
// TODO These three calls (hasClientExports, shouldForceResolvers, and
|
|
397
|
+
// usesNonreactiveDirective) are performing independent full traversals
|
|
398
|
+
// of the transformed document. We should consider merging these
|
|
399
|
+
// traversals into a single pass in the future, though the work is
|
|
400
|
+
// cached after the first time.
|
|
339
401
|
hasClientExports: hasClientExports(document),
|
|
340
402
|
hasForcedResolvers: this.localState.shouldForceResolvers(document),
|
|
341
403
|
hasNonreactiveDirective: hasDirectives(["nonreactive"], document),
|
|
@@ -346,6 +408,8 @@ var QueryManager = (function () {
|
|
|
346
408
|
{ name: "nonreactive" },
|
|
347
409
|
], document),
|
|
348
410
|
defaultVars: getDefaultValues(getOperationDefinition(document)),
|
|
411
|
+
// Transform any mutation or subscription operations to query operations
|
|
412
|
+
// so we can read/write them from/to the cache.
|
|
349
413
|
asQuery: __assign(__assign({}, document), { definitions: document.definitions.map(function (def) {
|
|
350
414
|
if (def.kind === "OperationDefinition" &&
|
|
351
415
|
def.operation !== "query") {
|
|
@@ -363,6 +427,9 @@ var QueryManager = (function () {
|
|
|
363
427
|
};
|
|
364
428
|
QueryManager.prototype.watchQuery = function (options) {
|
|
365
429
|
var query = this.transform(options.query);
|
|
430
|
+
// assign variable default values if supplied
|
|
431
|
+
// NOTE: We don't modify options.query here with the transformed query to
|
|
432
|
+
// ensure observable.options.query is set to the raw untransformed query.
|
|
366
433
|
options = __assign(__assign({}, options), { variables: this.getVariables(query, options.variables) });
|
|
367
434
|
if (typeof options.notifyOnNetworkStatusChange === "undefined") {
|
|
368
435
|
options.notifyOnNetworkStatusChange = false;
|
|
@@ -375,6 +442,8 @@ var QueryManager = (function () {
|
|
|
375
442
|
});
|
|
376
443
|
observable["lastQuery"] = query;
|
|
377
444
|
this.queries.set(observable.queryId, queryInfo);
|
|
445
|
+
// We give queryInfo the transformed query to ensure the first cache diff
|
|
446
|
+
// uses the transformed query instead of the raw query
|
|
378
447
|
queryInfo.init({
|
|
379
448
|
document: query,
|
|
380
449
|
observableQuery: observable,
|
|
@@ -413,9 +482,16 @@ var QueryManager = (function () {
|
|
|
413
482
|
if (options === void 0) { options = {
|
|
414
483
|
discardWatches: true,
|
|
415
484
|
}; }
|
|
485
|
+
// Before we have sent the reset action to the store, we can no longer
|
|
486
|
+
// rely on the results returned by in-flight requests since these may
|
|
487
|
+
// depend on values that previously existed in the data portion of the
|
|
488
|
+
// store. So, we cancel the promises and observers that we have issued
|
|
489
|
+
// so far and not yet resolved (in the case of queries).
|
|
416
490
|
this.cancelPendingFetches(newInvariantError(32));
|
|
417
491
|
this.queries.forEach(function (queryInfo) {
|
|
418
492
|
if (queryInfo.observableQuery) {
|
|
493
|
+
// Set loading to true so listeners don't trigger unless they want
|
|
494
|
+
// results with partial data.
|
|
419
495
|
queryInfo.networkStatus = NetworkStatus.loading;
|
|
420
496
|
}
|
|
421
497
|
else {
|
|
@@ -425,6 +501,7 @@ var QueryManager = (function () {
|
|
|
425
501
|
if (this.mutationStore) {
|
|
426
502
|
this.mutationStore = Object.create(null);
|
|
427
503
|
}
|
|
504
|
+
// begin removing data from the store
|
|
428
505
|
return this.cache.reset(options);
|
|
429
506
|
};
|
|
430
507
|
QueryManager.prototype.getObservableQueries = function (include) {
|
|
@@ -471,6 +548,9 @@ var QueryManager = (function () {
|
|
|
471
548
|
});
|
|
472
549
|
if (legacyQueryOptions.size) {
|
|
473
550
|
legacyQueryOptions.forEach(function (options) {
|
|
551
|
+
// We will be issuing a fresh network request for this query, so we
|
|
552
|
+
// pre-allocate a new query ID here, using a special prefix to enable
|
|
553
|
+
// cleaning up these temporary queries later, after fetching.
|
|
474
554
|
var queryId = makeUniqueId("legacyOneTimeQuery");
|
|
475
555
|
var queryInfo = _this.getQuery(queryId).init({
|
|
476
556
|
document: options.query,
|
|
@@ -522,6 +602,8 @@ var QueryManager = (function () {
|
|
|
522
602
|
var makeObservable = function (variables) {
|
|
523
603
|
return _this.getObservableFromLink(query, context, variables).map(function (result) {
|
|
524
604
|
if (fetchPolicy !== "no-cache") {
|
|
605
|
+
// the subscription interface should handle not sending us results we no longer subscribe to.
|
|
606
|
+
// XXX I don't think we ever send in an object with errors, but we might in the future...
|
|
525
607
|
if (shouldWriteResult(result, errorPolicy)) {
|
|
526
608
|
_this.cache.write({
|
|
527
609
|
query: query,
|
|
@@ -542,6 +624,9 @@ var QueryManager = (function () {
|
|
|
542
624
|
if (hasProtocolErrors) {
|
|
543
625
|
errors.protocolErrors = result.extensions[PROTOCOL_ERRORS_SYMBOL];
|
|
544
626
|
}
|
|
627
|
+
// `errorPolicy` is a mechanism for handling GraphQL errors, according
|
|
628
|
+
// to our documentation, so we throw protocol errors regardless of the
|
|
629
|
+
// set error policy.
|
|
545
630
|
if (errorPolicy === "none" || hasProtocolErrors) {
|
|
546
631
|
throw new ApolloError(errors);
|
|
547
632
|
}
|
|
@@ -573,6 +658,11 @@ var QueryManager = (function () {
|
|
|
573
658
|
this.removeQuery(queryId);
|
|
574
659
|
};
|
|
575
660
|
QueryManager.prototype.removeQuery = function (queryId) {
|
|
661
|
+
// teardown all links
|
|
662
|
+
// Both `QueryManager.fetchRequest` and `QueryManager.query` create separate promises
|
|
663
|
+
// that each add their reject functions to fetchCancelFns.
|
|
664
|
+
// A query created with `QueryManager.query()` could trigger a `QueryManager.fetchRequest`.
|
|
665
|
+
// The same queryId could have two rejection fns for two promises
|
|
576
666
|
this.fetchCancelFns.delete(queryId);
|
|
577
667
|
if (this.queries.has(queryId)) {
|
|
578
668
|
this.getQuery(queryId).stop();
|
|
@@ -587,7 +677,9 @@ var QueryManager = (function () {
|
|
|
587
677
|
QueryManager.prototype.getLocalState = function () {
|
|
588
678
|
return this.localState;
|
|
589
679
|
};
|
|
590
|
-
QueryManager.prototype.getObservableFromLink = function (query, context, variables,
|
|
680
|
+
QueryManager.prototype.getObservableFromLink = function (query, context, variables,
|
|
681
|
+
// Prefer context.queryDeduplication if specified.
|
|
682
|
+
deduplication) {
|
|
591
683
|
var _this = this;
|
|
592
684
|
var _a;
|
|
593
685
|
if (deduplication === void 0) { deduplication = (_a = context === null || context === void 0 ? void 0 : context.queryDeduplication) !== null && _a !== void 0 ? _a : this.queryDeduplication; }
|
|
@@ -644,16 +736,25 @@ var QueryManager = (function () {
|
|
|
644
736
|
};
|
|
645
737
|
QueryManager.prototype.getResultsFromLink = function (queryInfo, cacheWriteBehavior, options) {
|
|
646
738
|
var requestId = (queryInfo.lastRequestId = this.generateRequestId());
|
|
739
|
+
// Performing transformForLink here gives this.cache a chance to fill in
|
|
740
|
+
// missing fragment definitions (for example) before sending this document
|
|
741
|
+
// through the link chain.
|
|
647
742
|
var linkDocument = this.cache.transformForLink(options.query);
|
|
648
743
|
return asyncMap(this.getObservableFromLink(linkDocument, options.context, options.variables), function (result) {
|
|
649
744
|
var graphQLErrors = getGraphQLErrorsFromResult(result);
|
|
650
745
|
var hasErrors = graphQLErrors.length > 0;
|
|
746
|
+
// If we interrupted this request by calling getResultsFromLink again
|
|
747
|
+
// with the same QueryInfo object, we ignore the old results.
|
|
651
748
|
if (requestId >= queryInfo.lastRequestId) {
|
|
652
749
|
if (hasErrors && options.errorPolicy === "none") {
|
|
750
|
+
// Throwing here effectively calls observer.error.
|
|
653
751
|
throw queryInfo.markError(new ApolloError({
|
|
654
752
|
graphQLErrors: graphQLErrors,
|
|
655
753
|
}));
|
|
656
754
|
}
|
|
755
|
+
// Use linkDocument rather than queryInfo.document so the
|
|
756
|
+
// operation/fragments used to write the result are the same as the
|
|
757
|
+
// ones used to obtain it from the link.
|
|
657
758
|
queryInfo.markResult(result, linkDocument, options, cacheWriteBehavior);
|
|
658
759
|
queryInfo.markReady();
|
|
659
760
|
}
|
|
@@ -668,16 +769,19 @@ var QueryManager = (function () {
|
|
|
668
769
|
}
|
|
669
770
|
return aqr;
|
|
670
771
|
}, function (networkError) {
|
|
671
|
-
var error = isApolloError(networkError)
|
|
672
|
-
|
|
673
|
-
: new ApolloError({ networkError: networkError });
|
|
772
|
+
var error = isApolloError(networkError) ? networkError : (new ApolloError({ networkError: networkError }));
|
|
773
|
+
// Avoid storing errors from older interrupted queries.
|
|
674
774
|
if (requestId >= queryInfo.lastRequestId) {
|
|
675
775
|
queryInfo.markError(error);
|
|
676
776
|
}
|
|
677
777
|
throw error;
|
|
678
778
|
});
|
|
679
779
|
};
|
|
680
|
-
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options,
|
|
780
|
+
QueryManager.prototype.fetchConcastWithInfo = function (queryId, options,
|
|
781
|
+
// The initial networkStatus for this fetch, most often
|
|
782
|
+
// NetworkStatus.loading, but also possibly fetchMore, poll, refetch,
|
|
783
|
+
// or setVariables.
|
|
784
|
+
networkStatus, query) {
|
|
681
785
|
var _this = this;
|
|
682
786
|
if (networkStatus === void 0) { networkStatus = NetworkStatus.loading; }
|
|
683
787
|
if (query === void 0) { query = options.query; }
|
|
@@ -695,26 +799,49 @@ var QueryManager = (function () {
|
|
|
695
799
|
context: context,
|
|
696
800
|
});
|
|
697
801
|
var fromVariables = function (variables) {
|
|
802
|
+
// Since normalized is always a fresh copy of options, it's safe to
|
|
803
|
+
// modify its properties here, rather than creating yet another new
|
|
804
|
+
// WatchQueryOptions object.
|
|
698
805
|
normalized.variables = variables;
|
|
699
806
|
var sourcesWithInfo = _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);
|
|
700
|
-
if (
|
|
807
|
+
if (
|
|
808
|
+
// If we're in standby, postpone advancing options.fetchPolicy using
|
|
809
|
+
// applyNextFetchPolicy.
|
|
810
|
+
normalized.fetchPolicy !== "standby" &&
|
|
811
|
+
// The "standby" policy currently returns [] from fetchQueryByPolicy, so
|
|
812
|
+
// this is another way to detect when nothing was done/fetched.
|
|
701
813
|
sourcesWithInfo.sources.length > 0 &&
|
|
702
814
|
queryInfo.observableQuery) {
|
|
703
815
|
queryInfo.observableQuery["applyNextFetchPolicy"]("after-fetch", options);
|
|
704
816
|
}
|
|
705
817
|
return sourcesWithInfo;
|
|
706
818
|
};
|
|
819
|
+
// This cancel function needs to be set before the concast is created,
|
|
820
|
+
// in case concast creation synchronously cancels the request.
|
|
707
821
|
var cleanupCancelFn = function () { return _this.fetchCancelFns.delete(queryId); };
|
|
708
822
|
this.fetchCancelFns.set(queryId, function (reason) {
|
|
709
823
|
cleanupCancelFn();
|
|
824
|
+
// This delay ensures the concast variable has been initialized.
|
|
710
825
|
setTimeout(function () { return concast.cancel(reason); });
|
|
711
826
|
});
|
|
712
827
|
var concast, containsDataFromLink;
|
|
828
|
+
// If the query has @export(as: ...) directives, then we need to
|
|
829
|
+
// process those directives asynchronously. When there are no
|
|
830
|
+
// @export directives (the common case), we deliberately avoid
|
|
831
|
+
// wrapping the result of this.fetchQueryByPolicy in a Promise,
|
|
832
|
+
// since the timing of result delivery is (unfortunately) important
|
|
833
|
+
// for backwards compatibility. TODO This code could be simpler if
|
|
834
|
+
// we deprecated and removed LocalState.
|
|
713
835
|
if (this.getDocumentInfo(normalized.query).hasClientExports) {
|
|
714
836
|
concast = new Concast(this.localState
|
|
715
837
|
.addExportedVariables(normalized.query, normalized.variables, normalized.context)
|
|
716
838
|
.then(fromVariables)
|
|
717
839
|
.then(function (sourcesWithInfo) { return sourcesWithInfo.sources; }));
|
|
840
|
+
// there is just no way we can synchronously get the *right* value here,
|
|
841
|
+
// so we will assume `true`, which is the behaviour before the bug fix in
|
|
842
|
+
// #10597. This means that bug is not fixed in that case, and is probably
|
|
843
|
+
// un-fixable with reasonable effort for the edge case of @export as
|
|
844
|
+
// directives.
|
|
718
845
|
containsDataFromLink = true;
|
|
719
846
|
}
|
|
720
847
|
else {
|
|
@@ -744,23 +871,71 @@ var QueryManager = (function () {
|
|
|
744
871
|
if (updateCache) {
|
|
745
872
|
this.cache.batch({
|
|
746
873
|
update: updateCache,
|
|
874
|
+
// Since you can perform any combination of cache reads and/or writes in
|
|
875
|
+
// the cache.batch update function, its optimistic option can be either
|
|
876
|
+
// a boolean or a string, representing three distinct modes of
|
|
877
|
+
// operation:
|
|
878
|
+
//
|
|
879
|
+
// * false: read/write only the root layer
|
|
880
|
+
// * true: read/write the topmost layer
|
|
881
|
+
// * string: read/write a fresh optimistic layer with that ID string
|
|
882
|
+
//
|
|
883
|
+
// When typeof optimistic === "string", a new optimistic layer will be
|
|
884
|
+
// temporarily created within cache.batch with that string as its ID. If
|
|
885
|
+
// we then pass that same string as the removeOptimistic option, we can
|
|
886
|
+
// make cache.batch immediately remove the optimistic layer after
|
|
887
|
+
// running the updateCache function, triggering only one broadcast.
|
|
888
|
+
//
|
|
889
|
+
// However, the refetchQueries method accepts only true or false for its
|
|
890
|
+
// optimistic option (not string). We interpret true to mean a temporary
|
|
891
|
+
// optimistic layer should be created, to allow efficiently rolling back
|
|
892
|
+
// the effect of the updateCache function, which involves passing a
|
|
893
|
+
// string instead of true as the optimistic option to cache.batch, when
|
|
894
|
+
// refetchQueries receives optimistic: true.
|
|
895
|
+
//
|
|
896
|
+
// In other words, we are deliberately not supporting the use case of
|
|
897
|
+
// writing to an *existing* optimistic layer (using the refetchQueries
|
|
898
|
+
// updateCache function), since that would potentially interfere with
|
|
899
|
+
// other optimistic updates in progress. Instead, you can read/write
|
|
900
|
+
// only the root layer by passing optimistic: false to refetchQueries,
|
|
901
|
+
// or you can read/write a brand new optimistic layer that will be
|
|
902
|
+
// automatically removed by passing optimistic: true.
|
|
747
903
|
optimistic: (optimistic && removeOptimistic) || false,
|
|
904
|
+
// The removeOptimistic option can also be provided by itself, even if
|
|
905
|
+
// optimistic === false, to remove some previously-added optimistic
|
|
906
|
+
// layer safely and efficiently, like we do in markMutationResult.
|
|
907
|
+
//
|
|
908
|
+
// If an explicit removeOptimistic string is provided with optimistic:
|
|
909
|
+
// true, the removeOptimistic string will determine the ID of the
|
|
910
|
+
// temporary optimistic layer, in case that ever matters.
|
|
748
911
|
removeOptimistic: removeOptimistic,
|
|
749
912
|
onWatchUpdated: function (watch, diff, lastDiff) {
|
|
750
913
|
var oq = watch.watcher instanceof QueryInfo && watch.watcher.observableQuery;
|
|
751
914
|
if (oq) {
|
|
752
915
|
if (onQueryUpdated) {
|
|
916
|
+
// Since we're about to handle this query now, remove it from
|
|
917
|
+
// includedQueriesById, in case it was added earlier because of
|
|
918
|
+
// options.include.
|
|
753
919
|
includedQueriesById.delete(oq.queryId);
|
|
754
920
|
var result = onQueryUpdated(oq, diff, lastDiff);
|
|
755
921
|
if (result === true) {
|
|
922
|
+
// The onQueryUpdated function requested the default refetching
|
|
923
|
+
// behavior by returning true.
|
|
756
924
|
result = oq.refetch();
|
|
757
925
|
}
|
|
926
|
+
// Record the result in the results Map, as long as onQueryUpdated
|
|
927
|
+
// did not return false to skip/ignore this result.
|
|
758
928
|
if (result !== false) {
|
|
759
929
|
results.set(oq, result);
|
|
760
930
|
}
|
|
931
|
+
// Allow the default cache broadcast to happen, except when
|
|
932
|
+
// onQueryUpdated returns false.
|
|
761
933
|
return result;
|
|
762
934
|
}
|
|
763
935
|
if (onQueryUpdated !== null) {
|
|
936
|
+
// If we don't have an onQueryUpdated function, and onQueryUpdated
|
|
937
|
+
// was not disabled by passing null, make sure this query is
|
|
938
|
+
// "included" like any other options.include-specified query.
|
|
764
939
|
includedQueriesById.set(oq.queryId, { oq: oq, lastDiff: lastDiff, diff: diff });
|
|
765
940
|
}
|
|
766
941
|
}
|
|
@@ -771,14 +946,17 @@ var QueryManager = (function () {
|
|
|
771
946
|
includedQueriesById.forEach(function (_a, queryId) {
|
|
772
947
|
var oq = _a.oq, lastDiff = _a.lastDiff, diff = _a.diff;
|
|
773
948
|
var result;
|
|
949
|
+
// If onQueryUpdated is provided, we want to use it for all included
|
|
950
|
+
// queries, even the QueryOptions ones.
|
|
774
951
|
if (onQueryUpdated) {
|
|
775
952
|
if (!diff) {
|
|
776
953
|
var info = oq["queryInfo"];
|
|
777
|
-
info.reset();
|
|
954
|
+
info.reset(); // Force info.getDiff() to read from cache.
|
|
778
955
|
diff = info.getDiff();
|
|
779
956
|
}
|
|
780
957
|
result = onQueryUpdated(oq, diff, lastDiff);
|
|
781
958
|
}
|
|
959
|
+
// Otherwise, we fall back to refetching.
|
|
782
960
|
if (!onQueryUpdated || result === true) {
|
|
783
961
|
result = oq.refetch();
|
|
784
962
|
}
|
|
@@ -791,11 +969,22 @@ var QueryManager = (function () {
|
|
|
791
969
|
});
|
|
792
970
|
}
|
|
793
971
|
if (removeOptimistic) {
|
|
972
|
+
// In case no updateCache callback was provided (so cache.batch was not
|
|
973
|
+
// called above, and thus did not already remove the optimistic layer),
|
|
974
|
+
// remove it here. Since this is a no-op when the layer has already been
|
|
975
|
+
// removed, we do it even if we called cache.batch above, since it's
|
|
976
|
+
// possible this.cache is an instance of some ApolloCache subclass other
|
|
977
|
+
// than InMemoryCache, and does not fully support the removeOptimistic
|
|
978
|
+
// option for cache.batch.
|
|
794
979
|
this.cache.removeOptimistic(removeOptimistic);
|
|
795
980
|
}
|
|
796
981
|
return results;
|
|
797
982
|
};
|
|
798
|
-
QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a,
|
|
983
|
+
QueryManager.prototype.fetchQueryByPolicy = function (queryInfo, _a,
|
|
984
|
+
// The initial networkStatus for this fetch, most often
|
|
985
|
+
// NetworkStatus.loading, but also possibly fetchMore, poll, refetch,
|
|
986
|
+
// or setVariables.
|
|
987
|
+
networkStatus) {
|
|
799
988
|
var _this = this;
|
|
800
989
|
var query = _a.query, variables = _a.variables, fetchPolicy = _a.fetchPolicy, refetchWritePolicy = _a.refetchWritePolicy, errorPolicy = _a.errorPolicy, returnPartialData = _a.returnPartialData, context = _a.context, notifyOnNetworkStatusChange = _a.notifyOnNetworkStatusChange;
|
|
801
990
|
var oldNetworkStatus = queryInfo.networkStatus;
|
|
@@ -825,6 +1014,10 @@ var QueryManager = (function () {
|
|
|
825
1014
|
})
|
|
826
1015
|
.then(function (resolved) { return fromData(resolved.data || void 0); });
|
|
827
1016
|
}
|
|
1017
|
+
// Resolves https://github.com/apollographql/apollo-client/issues/10317.
|
|
1018
|
+
// If errorPolicy is 'none' and notifyOnNetworkStatusChange is true,
|
|
1019
|
+
// data was incorrectly returned from the cache on refetch:
|
|
1020
|
+
// if diff.missing exists, we should not return cache data.
|
|
828
1021
|
if (errorPolicy === "none" &&
|
|
829
1022
|
networkStatus === NetworkStatus.refetch &&
|
|
830
1023
|
Array.isArray(diff.missing)) {
|
|
@@ -832,13 +1025,13 @@ var QueryManager = (function () {
|
|
|
832
1025
|
}
|
|
833
1026
|
return fromData(data);
|
|
834
1027
|
};
|
|
835
|
-
var cacheWriteBehavior = fetchPolicy === "no-cache"
|
|
836
|
-
|
|
837
|
-
:
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
1028
|
+
var cacheWriteBehavior = fetchPolicy === "no-cache" ? 0 /* CacheWriteBehavior.FORBID */
|
|
1029
|
+
// Watched queries must opt into overwriting existing data on refetch,
|
|
1030
|
+
// by passing refetchWritePolicy: "overwrite" in their WatchQueryOptions.
|
|
1031
|
+
: (networkStatus === NetworkStatus.refetch &&
|
|
1032
|
+
refetchWritePolicy !== "merge") ?
|
|
1033
|
+
1 /* CacheWriteBehavior.OVERWRITE */
|
|
1034
|
+
: 2 /* CacheWriteBehavior.MERGE */;
|
|
842
1035
|
var resultsFromLink = function () {
|
|
843
1036
|
return _this.getResultsFromLink(queryInfo, cacheWriteBehavior, {
|
|
844
1037
|
query: query,
|
|
@@ -897,6 +1090,9 @@ var QueryManager = (function () {
|
|
|
897
1090
|
if (shouldNotify) {
|
|
898
1091
|
return {
|
|
899
1092
|
fromLink: true,
|
|
1093
|
+
// Note that queryInfo.getDiff() for no-cache queries does not call
|
|
1094
|
+
// cache.diff, but instead returns a { complete: false } stub result
|
|
1095
|
+
// when there is no queryInfo.diff already defined.
|
|
900
1096
|
sources: [resultsFromCache(queryInfo.getDiff()), resultsFromLink()],
|
|
901
1097
|
};
|
|
902
1098
|
}
|