@apollo/client 3.8.0-beta.5 → 3.8.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apollo-client.cjs +282 -242
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +12 -12
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +12 -12
- package/cache/core/cache.d.ts +3 -3
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +3 -3
- package/cache/core/types/Cache.d.ts.map +1 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +2 -2
- package/cache/core/types/DataProxy.d.ts.map +1 -1
- package/cache/core/types/DataProxy.js.map +1 -1
- package/cache/core/types/common.d.ts +2 -2
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/index.d.ts +14 -14
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +13 -13
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +5 -5
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +5 -5
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js +1 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +8 -8
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +13 -13
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.d.ts +1 -1
- package/cache/inmemory/key-extractor.d.ts.map +1 -1
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +2 -3
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts +6 -6
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +9 -9
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.d.ts +1 -1
- package/cache/inmemory/reactiveVars.d.ts.map +1 -1
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +6 -6
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +7 -7
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +6 -6
- package/cache/inmemory/types.d.ts.map +1 -1
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +6 -6
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +10 -10
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/config/jest/setup.d.ts +1 -1
- package/config/jest/setup.d.ts.map +1 -1
- package/config/jest/setup.js +2 -2
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.d.ts +10 -10
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +12 -11
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +5 -5
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +5 -5
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +11 -10
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +17 -13
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +9 -9
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +4 -4
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +12 -12
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +25 -25
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +43 -37
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +43 -37
- package/core/equalByQuery.d.ts +2 -2
- package/core/equalByQuery.d.ts.map +1 -1
- package/core/equalByQuery.js +9 -8
- package/core/equalByQuery.js.map +1 -1
- package/core/index.d.ts +13 -13
- package/core/index.d.ts.map +1 -1
- package/core/index.js +12 -13
- package/core/index.js.map +1 -1
- package/core/types.d.ts +10 -10
- package/core/types.d.ts.map +1 -1
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +4 -4
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +73 -81
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +73 -81
- package/dev/index.d.ts +3 -3
- package/dev/index.d.ts.map +1 -1
- package/dev/index.js +3 -3
- package/dev/index.js.map +1 -1
- package/dev/loadDevMessages.js +2 -2
- package/dev/loadDevMessages.js.map +1 -1
- package/dev/loadErrorMessageHandler.d.ts +1 -1
- package/dev/loadErrorMessageHandler.d.ts.map +1 -1
- package/dev/loadErrorMessageHandler.js +2 -2
- package/dev/loadErrorMessageHandler.js.map +1 -1
- package/dev/loadErrorMessages.js +2 -2
- package/dev/loadErrorMessages.js.map +1 -1
- package/errors/errors.cjs.map +1 -1
- package/errors/index.d.ts +4 -4
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +2 -2
- package/errors/index.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/invariantErrorCodes.js +71 -78
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batchLink.d.ts +5 -5
- package/link/batch/batchLink.d.ts.map +1 -1
- package/link/batch/batchLink.js +3 -3
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.d.ts +2 -2
- package/link/batch/batching.d.ts.map +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.d.ts.map +1 -1
- package/link/batch/index.js +1 -1
- package/link/batch/index.js.map +1 -1
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batchHttpLink.d.ts +5 -5
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js +5 -5
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/batch-http/index.d.ts +1 -1
- package/link/batch-http/index.d.ts.map +1 -1
- package/link/batch-http/index.js +1 -1
- package/link/batch-http/index.js.map +1 -1
- package/link/context/context.cjs.map +1 -1
- package/link/context/index.d.ts +3 -3
- package/link/context/index.d.ts.map +1 -1
- package/link/context/index.js +2 -2
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.d.ts +3 -3
- package/link/core/ApolloLink.d.ts.map +1 -1
- package/link/core/ApolloLink.js +5 -5
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/concat.d.ts +1 -1
- package/link/core/concat.d.ts.map +1 -1
- package/link/core/concat.js +1 -1
- package/link/core/concat.js.map +1 -1
- package/link/core/core.cjs +2 -2
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +2 -2
- package/link/core/empty.d.ts +1 -1
- package/link/core/empty.d.ts.map +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.d.ts.map +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.d.ts.map +1 -1
- package/link/core/from.js +1 -1
- package/link/core/from.js.map +1 -1
- package/link/core/index.d.ts +8 -8
- package/link/core/index.d.ts.map +1 -1
- package/link/core/index.js +8 -8
- package/link/core/index.js.map +1 -1
- package/link/core/split.d.ts +1 -1
- package/link/core/split.d.ts.map +1 -1
- package/link/core/split.js +1 -1
- package/link/core/split.js.map +1 -1
- package/link/core/types.d.ts +2 -2
- package/link/core/types.d.ts.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/error/error.cjs.map +1 -1
- package/link/error/index.d.ts +4 -4
- package/link/error/index.d.ts.map +1 -1
- package/link/error/index.js +2 -2
- package/link/error/index.js.map +1 -1
- package/link/http/HttpLink.d.ts +3 -3
- package/link/http/HttpLink.d.ts.map +1 -1
- package/link/http/HttpLink.js +2 -2
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.js +2 -2
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.d.ts +2 -2
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +14 -14
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +4 -4
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +4 -4
- package/link/http/index.d.ts +10 -10
- package/link/http/index.d.ts.map +1 -1
- package/link/http/index.js +10 -10
- package/link/http/index.js.map +1 -1
- package/link/http/iterators/nodeStream.js.map +1 -1
- package/link/http/iterators/promise.js.map +1 -1
- package/link/http/iterators/reader.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +2 -2
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/responseIterator.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +1 -1
- package/link/http/rewriteURIForGET.d.ts.map +1 -1
- package/link/http/rewriteURIForGET.js +1 -1
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +2 -2
- package/link/http/selectHttpOptionsAndBody.d.ts.map +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.d.ts.map +1 -1
- package/link/http/selectURI.js.map +1 -1
- package/link/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.d.ts.map +1 -1
- package/link/http/serializeFetchParameter.js +2 -2
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.d.ts +3 -3
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +6 -6
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +2 -2
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
- package/link/remove-typename/index.d.ts +1 -1
- package/link/remove-typename/index.d.ts.map +1 -1
- package/link/remove-typename/index.js +1 -1
- package/link/remove-typename/index.js.map +1 -1
- package/link/remove-typename/remove-typename.cjs.map +1 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts +1 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts.map +1 -1
- package/link/remove-typename/removeTypenameFromVariables.js +2 -2
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/link/retry/delayFunction.d.ts +1 -1
- package/link/retry/delayFunction.d.ts.map +1 -1
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/index.d.ts +1 -1
- package/link/retry/index.d.ts.map +1 -1
- package/link/retry/index.js +1 -1
- package/link/retry/index.js.map +1 -1
- package/link/retry/retry.cjs.map +1 -1
- package/link/retry/retryFunction.d.ts +1 -1
- package/link/retry/retryFunction.d.ts.map +1 -1
- package/link/retry/retryFunction.js.map +1 -1
- package/link/retry/retryLink.d.ts +5 -5
- package/link/retry/retryLink.d.ts.map +1 -1
- package/link/retry/retryLink.js +4 -4
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +3 -3
- package/link/schema/index.d.ts.map +1 -1
- package/link/schema/index.js +2 -2
- package/link/schema/index.js.map +1 -1
- package/link/schema/schema.cjs.map +1 -1
- package/link/subscriptions/index.d.ts +3 -3
- package/link/subscriptions/index.d.ts.map +1 -1
- package/link/subscriptions/index.js +1 -1
- package/link/subscriptions/index.js.map +1 -1
- package/link/subscriptions/subscriptions.cjs.map +1 -1
- package/link/utils/createOperation.d.ts +1 -1
- package/link/utils/createOperation.d.ts.map +1 -1
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/fromError.d.ts +1 -1
- package/link/utils/fromError.d.ts.map +1 -1
- package/link/utils/fromError.js +1 -1
- package/link/utils/fromError.js.map +1 -1
- package/link/utils/fromPromise.d.ts +1 -1
- package/link/utils/fromPromise.d.ts.map +1 -1
- package/link/utils/fromPromise.js +1 -1
- package/link/utils/fromPromise.js.map +1 -1
- package/link/utils/index.d.ts +9 -9
- package/link/utils/index.d.ts.map +1 -1
- package/link/utils/index.js +9 -9
- package/link/utils/index.js.map +1 -1
- package/link/utils/toPromise.d.ts +1 -1
- package/link/utils/toPromise.d.ts.map +1 -1
- package/link/utils/toPromise.js +2 -2
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/transformOperation.d.ts +1 -1
- package/link/utils/transformOperation.d.ts.map +1 -1
- package/link/utils/transformOperation.js +1 -1
- 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.d.ts +1 -1
- package/link/utils/validateOperation.d.ts.map +1 -1
- package/link/utils/validateOperation.js +2 -2
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +3 -3
- package/link/ws/index.d.ts.map +1 -1
- package/link/ws/index.js +1 -1
- package/link/ws/index.js.map +1 -1
- package/link/ws/ws.cjs.map +1 -1
- package/package.json +18 -14
- package/react/cache/QueryReference.d.ts +9 -6
- package/react/cache/QueryReference.d.ts.map +1 -1
- package/react/cache/QueryReference.js +108 -52
- package/react/cache/QueryReference.js.map +1 -1
- package/react/cache/SuspenseCache.d.ts +3 -3
- package/react/cache/SuspenseCache.d.ts.map +1 -1
- package/react/cache/SuspenseCache.js +2 -2
- package/react/cache/SuspenseCache.js.map +1 -1
- package/react/cache/index.d.ts +1 -1
- package/react/cache/index.d.ts.map +1 -1
- package/react/cache/index.js +1 -1
- package/react/cache/index.js.map +1 -1
- package/react/components/Mutation.d.ts +3 -3
- package/react/components/Mutation.d.ts.map +1 -1
- package/react/components/Mutation.js +1 -1
- package/react/components/Mutation.js.map +1 -1
- package/react/components/Query.d.ts +2 -2
- package/react/components/Query.d.ts.map +1 -1
- package/react/components/Query.js +1 -1
- package/react/components/Query.js.map +1 -1
- package/react/components/Subscription.d.ts +2 -2
- package/react/components/Subscription.d.ts.map +1 -1
- package/react/components/Subscription.js +1 -1
- package/react/components/Subscription.js.map +1 -1
- package/react/components/components.cjs.map +1 -1
- package/react/components/index.d.ts +4 -4
- package/react/components/index.d.ts.map +1 -1
- package/react/components/index.js +4 -4
- package/react/components/index.js.map +1 -1
- package/react/components/types.d.ts +2 -2
- package/react/components/types.d.ts.map +1 -1
- package/react/components/types.js.map +1 -1
- package/react/context/ApolloConsumer.d.ts +1 -1
- package/react/context/ApolloConsumer.d.ts.map +1 -1
- package/react/context/ApolloConsumer.js +3 -3
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloContext.d.ts +4 -5
- package/react/context/ApolloContext.d.ts.map +1 -1
- package/react/context/ApolloContext.js +12 -5
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.d.ts +2 -2
- package/react/context/ApolloProvider.d.ts.map +1 -1
- package/react/context/ApolloProvider.js +3 -3
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/context/context.cjs +12 -5
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +12 -5
- package/react/context/index.d.ts +4 -4
- package/react/context/index.d.ts.map +1 -1
- package/react/context/index.js +4 -4
- package/react/context/index.js.map +1 -1
- package/react/hoc/graphql.d.ts +2 -2
- package/react/hoc/graphql.d.ts.map +1 -1
- package/react/hoc/graphql.js +4 -4
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts +2 -2
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +2 -2
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/hoc.cjs +2 -2
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +2 -2
- package/react/hoc/index.d.ts +7 -7
- package/react/hoc/index.d.ts.map +1 -1
- package/react/hoc/index.js +7 -7
- package/react/hoc/index.js.map +1 -1
- package/react/hoc/mutation-hoc.d.ts +3 -3
- package/react/hoc/mutation-hoc.d.ts.map +1 -1
- package/react/hoc/mutation-hoc.js +3 -3
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.d.ts +1 -1
- package/react/hoc/query-hoc.d.ts.map +1 -1
- package/react/hoc/query-hoc.js +3 -3
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.d.ts +1 -1
- package/react/hoc/subscription-hoc.d.ts.map +1 -1
- package/react/hoc/subscription-hoc.js +3 -3
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/types.d.ts +4 -4
- package/react/hoc/types.d.ts.map +1 -1
- package/react/hoc/types.js.map +1 -1
- package/react/hoc/withApollo.d.ts +1 -1
- package/react/hoc/withApollo.d.ts.map +1 -1
- package/react/hoc/withApollo.js +3 -3
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs +179 -140
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +179 -140
- package/react/hooks/index.d.ts +11 -11
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/index.js +11 -11
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/internal/__use.js +2 -2
- package/react/hooks/internal/__use.js.map +1 -1
- package/react/hooks/internal/index.d.ts +3 -4
- package/react/hooks/internal/index.d.ts.map +1 -1
- package/react/hooks/internal/index.js +3 -4
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/internal/useDeepMemo.js +2 -2
- package/react/hooks/internal/useDeepMemo.js.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts +2 -2
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +4 -4
- package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
- package/react/hooks/useApolloClient.d.ts +1 -1
- package/react/hooks/useApolloClient.d.ts.map +1 -1
- package/react/hooks/useApolloClient.js +5 -5
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +5 -5
- package/react/hooks/useBackgroundQuery.d.ts.map +1 -1
- package/react/hooks/useBackgroundQuery.js +16 -17
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.d.ts +4 -4
- package/react/hooks/useFragment.d.ts.map +1 -1
- package/react/hooks/useFragment.js +2 -2
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +2 -2
- package/react/hooks/useLazyQuery.d.ts.map +1 -1
- package/react/hooks/useLazyQuery.js +9 -9
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +2 -2
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +10 -10
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +4 -4
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +17 -17
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReactiveVar.d.ts +1 -1
- package/react/hooks/useReactiveVar.d.ts.map +1 -1
- package/react/hooks/useReactiveVar.js +3 -3
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +3 -3
- package/react/hooks/useReadQuery.d.ts.map +1 -1
- package/react/hooks/useReadQuery.js +6 -6
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +2 -2
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +14 -14
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseCache.d.ts +1 -1
- package/react/hooks/useSuspenseCache.d.ts.map +1 -1
- package/react/hooks/useSuspenseCache.js +5 -5
- package/react/hooks/useSuspenseCache.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +4 -6
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js +30 -34
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +4 -4
- package/react/hooks/useSyncExternalStore.js.map +1 -1
- package/react/index.d.ts +6 -6
- package/react/index.d.ts.map +1 -1
- package/react/index.js +6 -6
- package/react/index.js.map +1 -1
- package/react/parser/index.js +6 -6
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +5 -5
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +5 -5
- package/react/react.cjs +106 -50
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +106 -50
- package/react/ssr/RenderPromises.d.ts +2 -2
- package/react/ssr/RenderPromises.d.ts.map +1 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/getDataFromTree.js +2 -2
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/index.d.ts +3 -3
- package/react/ssr/index.d.ts.map +1 -1
- package/react/ssr/index.js +3 -3
- package/react/ssr/index.js.map +1 -1
- package/react/ssr/renderToStringWithData.js +1 -1
- package/react/ssr/renderToStringWithData.js.map +1 -1
- package/react/ssr/ssr.cjs.map +1 -1
- package/react/types/types.d.ts +7 -7
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +1 -1
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +1 -1
- package/testing/core/index.d.ts +7 -7
- package/testing/core/index.d.ts.map +1 -1
- package/testing/core/index.js +7 -7
- package/testing/core/index.js.map +1 -1
- package/testing/core/mocking/mockClient.d.ts +2 -2
- package/testing/core/mocking/mockClient.d.ts.map +1 -1
- package/testing/core/mocking/mockClient.js +3 -3
- package/testing/core/mocking/mockClient.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +3 -3
- package/testing/core/mocking/mockLink.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +4 -4
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts +3 -3
- package/testing/core/mocking/mockQueryManager.d.ts.map +1 -1
- package/testing/core/mocking/mockQueryManager.js +3 -3
- package/testing/core/mocking/mockQueryManager.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +3 -3
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js +2 -2
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts +2 -2
- package/testing/core/mocking/mockWatchQuery.d.ts.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 +2 -2
- package/testing/core/observableToPromise.d.ts.map +1 -1
- package/testing/core/observableToPromise.js.map +1 -1
- package/testing/core/subscribeAndCount.d.ts +1 -1
- package/testing/core/subscribeAndCount.d.ts.map +1 -1
- package/testing/core/subscribeAndCount.js +1 -1
- package/testing/core/subscribeAndCount.js.map +1 -1
- package/testing/index.d.ts +3 -3
- package/testing/index.d.ts.map +1 -1
- package/testing/index.js +3 -3
- package/testing/index.js.map +1 -1
- package/testing/matchers/index.js +2 -2
- package/testing/matchers/index.js.map +1 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts +1 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts.map +1 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js +2 -2
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +1 -1
- package/testing/matchers/toMatchDocument.d.ts +1 -1
- package/testing/matchers/toMatchDocument.d.ts.map +1 -1
- package/testing/matchers/toMatchDocument.js +1 -1
- package/testing/matchers/toMatchDocument.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +7 -7
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js +5 -5
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs.map +1 -1
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/compact.d.ts +1 -1
- package/utilities/common/compact.d.ts.map +1 -1
- package/utilities/common/compact.js.map +1 -1
- package/utilities/common/errorHandling.d.ts +1 -1
- package/utilities/common/errorHandling.d.ts.map +1 -1
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/incrementalResult.d.ts +1 -1
- package/utilities/common/incrementalResult.d.ts.map +1 -1
- package/utilities/common/incrementalResult.js.map +1 -1
- package/utilities/common/maybeDeepFreeze.d.ts.map +1 -1
- package/utilities/common/maybeDeepFreeze.js +3 -4
- package/utilities/common/maybeDeepFreeze.js.map +1 -1
- package/utilities/common/mergeDeep.d.ts +1 -1
- package/utilities/common/mergeDeep.d.ts.map +1 -1
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts +1 -1
- package/utilities/common/mergeOptions.d.ts.map +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/common/omitDeep.d.ts +1 -1
- package/utilities/common/omitDeep.d.ts.map +1 -1
- package/utilities/common/omitDeep.js +1 -1
- package/utilities/common/omitDeep.js.map +1 -1
- package/utilities/common/responseIterator.js.map +1 -1
- package/utilities/common/stringifyForDisplay.js.map +1 -1
- package/utilities/common/stripTypename.d.ts +1 -1
- package/utilities/common/stripTypename.d.ts.map +1 -1
- package/utilities/common/stripTypename.js +1 -1
- package/utilities/common/stripTypename.js.map +1 -1
- package/utilities/globals/global.d.ts.map +1 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/globals.cjs +4 -16
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +4 -16
- package/utilities/globals/index.d.ts +5 -6
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +2 -5
- package/utilities/globals/index.js.map +1 -1
- package/utilities/globals/invariantWrappers.d.ts +1 -1
- package/utilities/globals/invariantWrappers.d.ts.map +1 -1
- package/utilities/globals/invariantWrappers.js +3 -3
- package/utilities/globals/invariantWrappers.js.map +1 -1
- package/utilities/graphql/DocumentTransform.js +4 -4
- package/utilities/graphql/DocumentTransform.js.map +1 -1
- package/utilities/graphql/directives.js +5 -5
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.js +4 -4
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.js +10 -10
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/operations.d.ts +1 -1
- package/utilities/graphql/operations.d.ts.map +1 -1
- package/utilities/graphql/operations.js +1 -1
- package/utilities/graphql/operations.js.map +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.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +4 -4
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.js +7 -7
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +34 -34
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +32 -32
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.d.ts +2 -2
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/asyncMap.d.ts +1 -1
- package/utilities/observables/asyncMap.d.ts.map +1 -1
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/observables/iteration.d.ts +1 -1
- package/utilities/observables/iteration.d.ts.map +1 -1
- package/utilities/observables/iteration.js.map +1 -1
- package/utilities/observables/subclassing.d.ts +1 -1
- package/utilities/observables/subclassing.d.ts.map +1 -1
- package/utilities/observables/subclassing.js.map +1 -1
- package/utilities/policies/pagination.d.ts +1 -1
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +1 -1
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/promises/decoration.d.ts.map +1 -1
- package/utilities/promises/decoration.js +1 -0
- package/utilities/promises/decoration.js.map +1 -1
- package/utilities/types/DeepOmit.d.ts +1 -1
- package/utilities/types/DeepOmit.d.ts.map +1 -1
- package/utilities/types/DeepOmit.js.map +1 -1
- package/utilities/types/DeepPartial.d.ts +1 -1
- package/utilities/types/DeepPartial.d.ts.map +1 -1
- package/utilities/types/DeepPartial.js.map +1 -1
- package/utilities/utilities.cjs +22 -21
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +22 -21
- package/version.js +1 -1
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts +0 -2
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts.map +0 -1
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.js +0 -11
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.js.map +0 -1
- package/utilities/globals/DEV.d.ts +0 -3
- package/utilities/globals/DEV.d.ts.map +0 -1
- package/utilities/globals/DEV.js +0 -4
- package/utilities/globals/DEV.js.map +0 -1
- package/utilities/globals/fix-graphql.d.ts +0 -2
- package/utilities/globals/fix-graphql.d.ts.map +0 -1
- package/utilities/globals/fix-graphql.js +0 -6
- package/utilities/globals/fix-graphql.js.map +0 -1
|
@@ -29,13 +29,12 @@ function _interopNamespace(e) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
32
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
33
32
|
var invariant__default = /*#__PURE__*/_interopDefaultLegacy(invariant);
|
|
34
33
|
|
|
35
34
|
function useApolloClient(override) {
|
|
36
|
-
var context$1 =
|
|
35
|
+
var context$1 = React__namespace.useContext(context.getApolloContext());
|
|
37
36
|
var client = override || context$1.client;
|
|
38
|
-
globals.invariant(!!client,
|
|
37
|
+
globals.invariant(!!client, 47);
|
|
39
38
|
return client;
|
|
40
39
|
}
|
|
41
40
|
|
|
@@ -44,11 +43,11 @@ var uSESKey = "useSyncExternalStore";
|
|
|
44
43
|
var realHook$1 = React__namespace[uSESKey];
|
|
45
44
|
var useSyncExternalStore = realHook$1 || (function (subscribe, getSnapshot, getServerSnapshot) {
|
|
46
45
|
var value = getSnapshot();
|
|
47
|
-
if (
|
|
46
|
+
if (globalThis.__DEV__ !== false &&
|
|
48
47
|
!didWarnUncachedGetSnapshot &&
|
|
49
48
|
value !== getSnapshot()) {
|
|
50
49
|
didWarnUncachedGetSnapshot = true;
|
|
51
|
-
|
|
50
|
+
globalThis.__DEV__ !== false && globals.invariant.error(57);
|
|
52
51
|
}
|
|
53
52
|
var _a = React__namespace.useState({ inst: { value: value, getSnapshot: getSnapshot } }), inst = _a[0].inst, forceUpdate = _a[1];
|
|
54
53
|
if (utilities.canUseLayoutEffect) {
|
|
@@ -90,14 +89,14 @@ function useQuery(query, options) {
|
|
|
90
89
|
return useInternalState(useApolloClient(options.client), query).useQuery(options);
|
|
91
90
|
}
|
|
92
91
|
function useInternalState(client, query) {
|
|
93
|
-
var stateRef =
|
|
92
|
+
var stateRef = React__namespace.useRef();
|
|
94
93
|
if (!stateRef.current ||
|
|
95
94
|
client !== stateRef.current.client ||
|
|
96
95
|
query !== stateRef.current.query) {
|
|
97
96
|
stateRef.current = new InternalState(client, query, stateRef.current);
|
|
98
97
|
}
|
|
99
98
|
var state = stateRef.current;
|
|
100
|
-
var _a =
|
|
99
|
+
var _a = React__namespace.useState(0); _a[0]; var setTick = _a[1];
|
|
101
100
|
state.forceUpdate = function () {
|
|
102
101
|
setTick(function (tick) { return tick + 1; });
|
|
103
102
|
};
|
|
@@ -128,7 +127,7 @@ var InternalState = (function () {
|
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
129
|
InternalState.prototype.forceUpdate = function () {
|
|
131
|
-
|
|
130
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(48);
|
|
132
131
|
};
|
|
133
132
|
InternalState.prototype.executeQuery = function (options) {
|
|
134
133
|
var _this = this;
|
|
@@ -158,10 +157,10 @@ var InternalState = (function () {
|
|
|
158
157
|
};
|
|
159
158
|
InternalState.prototype.useQuery = function (options) {
|
|
160
159
|
var _this = this;
|
|
161
|
-
this.renderPromises =
|
|
160
|
+
this.renderPromises = React__namespace.useContext(context.getApolloContext()).renderPromises;
|
|
162
161
|
this.useOptions(options);
|
|
163
162
|
var obsQuery = this.useObservableQuery();
|
|
164
|
-
var result = useSyncExternalStore(
|
|
163
|
+
var result = useSyncExternalStore(React__namespace.useCallback(function () {
|
|
165
164
|
if (_this.renderPromises) {
|
|
166
165
|
return function () { };
|
|
167
166
|
}
|
|
@@ -291,7 +290,7 @@ var InternalState = (function () {
|
|
|
291
290
|
&& this.renderPromises.getSSRObservable(this.watchQueryOptions)
|
|
292
291
|
|| this.observable
|
|
293
292
|
|| this.client.watchQuery(this.getObsQueryOptions());
|
|
294
|
-
this.obsQueryFields =
|
|
293
|
+
this.obsQueryFields = React__namespace.useMemo(function () { return ({
|
|
295
294
|
refetch: obsQuery.refetch.bind(obsQuery),
|
|
296
295
|
reobserve: obsQuery.reobserve.bind(obsQuery),
|
|
297
296
|
fetchMore: obsQuery.fetchMore.bind(obsQuery),
|
|
@@ -333,7 +332,7 @@ var InternalState = (function () {
|
|
|
333
332
|
_this.onCompleted(result.data);
|
|
334
333
|
}
|
|
335
334
|
}).catch(function (error) {
|
|
336
|
-
|
|
335
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(error);
|
|
337
336
|
});
|
|
338
337
|
}
|
|
339
338
|
};
|
|
@@ -385,9 +384,9 @@ var EAGER_METHODS = [
|
|
|
385
384
|
];
|
|
386
385
|
function useLazyQuery(query, options) {
|
|
387
386
|
var _a;
|
|
388
|
-
var execOptionsRef =
|
|
389
|
-
var optionsRef =
|
|
390
|
-
var queryRef =
|
|
387
|
+
var execOptionsRef = React__namespace.useRef();
|
|
388
|
+
var optionsRef = React__namespace.useRef();
|
|
389
|
+
var queryRef = React__namespace.useRef();
|
|
391
390
|
var merged = utilities.mergeOptions(options, execOptionsRef.current || {});
|
|
392
391
|
var document = (_a = merged === null || merged === void 0 ? void 0 : merged.query) !== null && _a !== void 0 ? _a : query;
|
|
393
392
|
optionsRef.current = merged;
|
|
@@ -399,7 +398,7 @@ function useLazyQuery(query, options) {
|
|
|
399
398
|
var result = Object.assign(useQueryResult, {
|
|
400
399
|
called: !!execOptionsRef.current,
|
|
401
400
|
});
|
|
402
|
-
var eagerMethods =
|
|
401
|
+
var eagerMethods = React__namespace.useMemo(function () {
|
|
403
402
|
var eagerMethods = {};
|
|
404
403
|
var _loop_1 = function (key) {
|
|
405
404
|
var method = result[key];
|
|
@@ -418,7 +417,7 @@ function useLazyQuery(query, options) {
|
|
|
418
417
|
return eagerMethods;
|
|
419
418
|
}, []);
|
|
420
419
|
Object.assign(result, eagerMethods);
|
|
421
|
-
var execute =
|
|
420
|
+
var execute = React__namespace.useCallback(function (executeOptions) {
|
|
422
421
|
execOptionsRef.current = executeOptions ? tslib.__assign(tslib.__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : {
|
|
423
422
|
fetchPolicy: initialFetchPolicy,
|
|
424
423
|
};
|
|
@@ -435,12 +434,12 @@ function useLazyQuery(query, options) {
|
|
|
435
434
|
function useMutation(mutation, options) {
|
|
436
435
|
var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);
|
|
437
436
|
parser.verifyDocumentType(mutation, parser.DocumentType.Mutation);
|
|
438
|
-
var _a =
|
|
437
|
+
var _a = React__namespace.useState({
|
|
439
438
|
called: false,
|
|
440
439
|
loading: false,
|
|
441
440
|
client: client,
|
|
442
441
|
}), result = _a[0], setResult = _a[1];
|
|
443
|
-
var ref =
|
|
442
|
+
var ref = React__namespace.useRef({
|
|
444
443
|
result: result,
|
|
445
444
|
mutationId: 0,
|
|
446
445
|
isMounted: true,
|
|
@@ -451,7 +450,7 @@ function useMutation(mutation, options) {
|
|
|
451
450
|
{
|
|
452
451
|
Object.assign(ref.current, { client: client, options: options, mutation: mutation });
|
|
453
452
|
}
|
|
454
|
-
var execute =
|
|
453
|
+
var execute = React__namespace.useCallback(function (executeOptions) {
|
|
455
454
|
if (executeOptions === void 0) { executeOptions = {}; }
|
|
456
455
|
var _a = ref.current, options = _a.options, mutation = _a.mutation;
|
|
457
456
|
var baseOptions = tslib.__assign(tslib.__assign({}, options), { mutation: mutation });
|
|
@@ -512,12 +511,12 @@ function useMutation(mutation, options) {
|
|
|
512
511
|
throw error;
|
|
513
512
|
});
|
|
514
513
|
}, []);
|
|
515
|
-
var reset =
|
|
514
|
+
var reset = React__namespace.useCallback(function () {
|
|
516
515
|
if (ref.current.isMounted) {
|
|
517
516
|
setResult({ called: false, loading: false, client: client });
|
|
518
517
|
}
|
|
519
518
|
}, []);
|
|
520
|
-
|
|
519
|
+
React__namespace.useEffect(function () {
|
|
521
520
|
ref.current.isMounted = true;
|
|
522
521
|
return function () {
|
|
523
522
|
ref.current.isMounted = false;
|
|
@@ -527,10 +526,10 @@ function useMutation(mutation, options) {
|
|
|
527
526
|
}
|
|
528
527
|
|
|
529
528
|
function useSubscription(subscription, options) {
|
|
530
|
-
var hasIssuedDeprecationWarningRef =
|
|
529
|
+
var hasIssuedDeprecationWarningRef = React__namespace.useRef(false);
|
|
531
530
|
var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);
|
|
532
531
|
parser.verifyDocumentType(subscription, parser.DocumentType.Subscription);
|
|
533
|
-
var _a =
|
|
532
|
+
var _a = React__namespace.useState({
|
|
534
533
|
loading: !(options === null || options === void 0 ? void 0 : options.skip),
|
|
535
534
|
error: void 0,
|
|
536
535
|
data: void 0,
|
|
@@ -539,13 +538,13 @@ function useSubscription(subscription, options) {
|
|
|
539
538
|
if (!hasIssuedDeprecationWarningRef.current) {
|
|
540
539
|
hasIssuedDeprecationWarningRef.current = true;
|
|
541
540
|
if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) {
|
|
542
|
-
|
|
541
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(options.onData ? 50 : 51);
|
|
543
542
|
}
|
|
544
543
|
if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) {
|
|
545
|
-
|
|
544
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(options.onComplete ? 52 : 53);
|
|
546
545
|
}
|
|
547
546
|
}
|
|
548
|
-
var _b =
|
|
547
|
+
var _b = React__namespace.useState(function () {
|
|
549
548
|
if (options === null || options === void 0 ? void 0 : options.skip) {
|
|
550
549
|
return null;
|
|
551
550
|
}
|
|
@@ -556,14 +555,14 @@ function useSubscription(subscription, options) {
|
|
|
556
555
|
context: options === null || options === void 0 ? void 0 : options.context,
|
|
557
556
|
});
|
|
558
557
|
}), observable = _b[0], setObservable = _b[1];
|
|
559
|
-
var canResetObservableRef =
|
|
560
|
-
|
|
558
|
+
var canResetObservableRef = React__namespace.useRef(false);
|
|
559
|
+
React__namespace.useEffect(function () {
|
|
561
560
|
return function () {
|
|
562
561
|
canResetObservableRef.current = true;
|
|
563
562
|
};
|
|
564
563
|
}, []);
|
|
565
|
-
var ref =
|
|
566
|
-
|
|
564
|
+
var ref = React__namespace.useRef({ client: client, subscription: subscription, options: options });
|
|
565
|
+
React__namespace.useEffect(function () {
|
|
567
566
|
var _a, _b, _c, _d;
|
|
568
567
|
var shouldResubscribe = options === null || options === void 0 ? void 0 : options.shouldResubscribe;
|
|
569
568
|
if (typeof shouldResubscribe === 'function') {
|
|
@@ -604,7 +603,7 @@ function useSubscription(subscription, options) {
|
|
|
604
603
|
}
|
|
605
604
|
Object.assign(ref.current, { client: client, subscription: subscription, options: options });
|
|
606
605
|
}, [client, subscription, options, canResetObservableRef.current]);
|
|
607
|
-
|
|
606
|
+
React__namespace.useEffect(function () {
|
|
608
607
|
if (!observable) {
|
|
609
608
|
return;
|
|
610
609
|
}
|
|
@@ -671,8 +670,8 @@ function useSubscription(subscription, options) {
|
|
|
671
670
|
|
|
672
671
|
function useReactiveVar(rv) {
|
|
673
672
|
var value = rv();
|
|
674
|
-
var setValue =
|
|
675
|
-
|
|
673
|
+
var setValue = React__namespace.useState(value)[1];
|
|
674
|
+
React__namespace.useEffect(function () {
|
|
676
675
|
var probablySameValue = rv();
|
|
677
676
|
if (value !== probablySameValue) {
|
|
678
677
|
setValue(probablySameValue);
|
|
@@ -688,7 +687,7 @@ function useFragment(options) {
|
|
|
688
687
|
var cache = useApolloClient().cache;
|
|
689
688
|
var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = tslib.__rest(options, ["fragment", "fragmentName", "from", "optimistic"]);
|
|
690
689
|
var diffOptions = tslib.__assign(tslib.__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
|
|
691
|
-
var resultRef =
|
|
690
|
+
var resultRef = React__namespace.useRef();
|
|
692
691
|
var latestDiff = cache.diff(diffOptions);
|
|
693
692
|
var getSnapshot = function () {
|
|
694
693
|
var latestDiffToResult = diffToResult(latestDiff);
|
|
@@ -718,25 +717,15 @@ function diffToResult(diff) {
|
|
|
718
717
|
}
|
|
719
718
|
|
|
720
719
|
function useDeepMemo(memoFn, deps) {
|
|
721
|
-
var ref =
|
|
720
|
+
var ref = React__namespace.useRef();
|
|
722
721
|
if (!ref.current || !equality.equal(ref.current.deps, deps)) {
|
|
723
722
|
ref.current = { value: memoFn(), deps: deps };
|
|
724
723
|
}
|
|
725
724
|
return ref.current.value;
|
|
726
725
|
}
|
|
727
726
|
|
|
728
|
-
function useStrictModeSafeCleanupEffect(cleanup) {
|
|
729
|
-
var timeout;
|
|
730
|
-
React.useEffect(function () {
|
|
731
|
-
clearTimeout(timeout);
|
|
732
|
-
return function () {
|
|
733
|
-
timeout = setTimeout(cleanup);
|
|
734
|
-
};
|
|
735
|
-
}, []);
|
|
736
|
-
}
|
|
737
|
-
|
|
738
727
|
var useKey = 'use';
|
|
739
|
-
var realHook =
|
|
728
|
+
var realHook = React__namespace[useKey];
|
|
740
729
|
var __use = realHook ||
|
|
741
730
|
function __use(promise) {
|
|
742
731
|
var statefulPromise = utilities.wrapPromiseWithState(promise);
|
|
@@ -751,9 +740,9 @@ var __use = realHook ||
|
|
|
751
740
|
};
|
|
752
741
|
|
|
753
742
|
function useSuspenseCache(override) {
|
|
754
|
-
var context$1 =
|
|
743
|
+
var context$1 = React__namespace.useContext(context.getApolloContext());
|
|
755
744
|
var suspenseCache = override || context$1.suspenseCache;
|
|
756
|
-
globals.invariant(suspenseCache,
|
|
745
|
+
globals.invariant(suspenseCache, 54);
|
|
757
746
|
return suspenseCache;
|
|
758
747
|
}
|
|
759
748
|
|
|
@@ -768,26 +757,29 @@ function useSuspenseQuery(query, options) {
|
|
|
768
757
|
var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
|
|
769
758
|
return client.watchQuery(watchQueryOptions);
|
|
770
759
|
});
|
|
771
|
-
var
|
|
772
|
-
var _b = React.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
|
|
760
|
+
var _b = React__namespace.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
|
|
773
761
|
var promise = promiseCache.get(queryRef.key);
|
|
774
|
-
if (
|
|
775
|
-
promise = queryRef.
|
|
762
|
+
if (queryRef.didChangeOptions(watchQueryOptions)) {
|
|
763
|
+
promise = queryRef.applyOptions(watchQueryOptions);
|
|
776
764
|
promiseCache.set(queryRef.key, promise);
|
|
777
765
|
}
|
|
778
766
|
if (!promise) {
|
|
779
767
|
promise = queryRef.promise;
|
|
780
768
|
promiseCache.set(queryRef.key, promise);
|
|
781
769
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
770
|
+
React__namespace.useEffect(function () {
|
|
771
|
+
var dispose = queryRef.retain();
|
|
772
|
+
var removeListener = queryRef.listen(function (promise) {
|
|
785
773
|
setPromiseCache(function (promiseCache) {
|
|
786
774
|
return new Map(promiseCache).set(queryRef.key, promise);
|
|
787
775
|
});
|
|
788
776
|
});
|
|
777
|
+
return function () {
|
|
778
|
+
removeListener();
|
|
779
|
+
dispose();
|
|
780
|
+
};
|
|
789
781
|
}, [queryRef]);
|
|
790
|
-
var skipResult =
|
|
782
|
+
var skipResult = React__namespace.useMemo(function () {
|
|
791
783
|
var error = toApolloError(queryRef.result);
|
|
792
784
|
return {
|
|
793
785
|
loading: false,
|
|
@@ -796,23 +788,23 @@ function useSuspenseQuery(query, options) {
|
|
|
796
788
|
error: error,
|
|
797
789
|
};
|
|
798
790
|
}, [queryRef.result]);
|
|
799
|
-
var result =
|
|
800
|
-
var fetchMore =
|
|
791
|
+
var result = fetchPolicy === 'standby' ? skipResult : __use(promise);
|
|
792
|
+
var fetchMore = React__namespace.useCallback(function (options) {
|
|
801
793
|
var promise = queryRef.fetchMore(options);
|
|
802
794
|
setPromiseCache(function (previousPromiseCache) {
|
|
803
|
-
return new Map(previousPromiseCache).set(queryRef.key, promise);
|
|
795
|
+
return new Map(previousPromiseCache).set(queryRef.key, queryRef.promise);
|
|
804
796
|
});
|
|
805
797
|
return promise;
|
|
806
798
|
}, [queryRef]);
|
|
807
|
-
var refetch =
|
|
799
|
+
var refetch = React__namespace.useCallback(function (variables) {
|
|
808
800
|
var promise = queryRef.refetch(variables);
|
|
809
801
|
setPromiseCache(function (previousPromiseCache) {
|
|
810
|
-
return new Map(previousPromiseCache).set(queryRef.key, promise);
|
|
802
|
+
return new Map(previousPromiseCache).set(queryRef.key, queryRef.promise);
|
|
811
803
|
});
|
|
812
804
|
return promise;
|
|
813
805
|
}, [queryRef]);
|
|
814
|
-
var subscribeToMore =
|
|
815
|
-
return
|
|
806
|
+
var subscribeToMore = React__namespace.useCallback(function (options) { return queryRef.observable.subscribeToMore(options); }, [queryRef]);
|
|
807
|
+
return React__namespace.useMemo(function () {
|
|
816
808
|
return {
|
|
817
809
|
client: client,
|
|
818
810
|
data: result.data,
|
|
@@ -838,11 +830,11 @@ function validateFetchPolicy(fetchPolicy) {
|
|
|
838
830
|
'no-cache',
|
|
839
831
|
'cache-and-network',
|
|
840
832
|
];
|
|
841
|
-
globals.invariant(supportedFetchPolicies.includes(fetchPolicy),
|
|
833
|
+
globals.invariant(supportedFetchPolicies.includes(fetchPolicy), 55, fetchPolicy);
|
|
842
834
|
}
|
|
843
835
|
function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
844
836
|
if (fetchPolicy === 'no-cache' && returnPartialData) {
|
|
845
|
-
|
|
837
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(56);
|
|
846
838
|
}
|
|
847
839
|
}
|
|
848
840
|
function toApolloError(result) {
|
|
@@ -850,13 +842,6 @@ function toApolloError(result) {
|
|
|
850
842
|
? new core.ApolloError({ graphQLErrors: result.errors })
|
|
851
843
|
: result.error;
|
|
852
844
|
}
|
|
853
|
-
function useTrackedQueryRefs(queryRef) {
|
|
854
|
-
var trackedQueryRefs = React.useRef(new Set());
|
|
855
|
-
trackedQueryRefs.current.add(queryRef);
|
|
856
|
-
useStrictModeSafeCleanupEffect(function () {
|
|
857
|
-
trackedQueryRefs.current.forEach(function (sub) { return sub.dispose(); });
|
|
858
|
-
});
|
|
859
|
-
}
|
|
860
845
|
function useWatchQueryOptions(_a) {
|
|
861
846
|
var client = _a.client, query = _a.query, options = _a.options;
|
|
862
847
|
return useDeepMemo(function () {
|
|
@@ -865,7 +850,7 @@ function useWatchQueryOptions(_a) {
|
|
|
865
850
|
((_a = client.defaultOptions.watchQuery) === null || _a === void 0 ? void 0 : _a.fetchPolicy) ||
|
|
866
851
|
'cache-first';
|
|
867
852
|
var watchQueryOptions = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: fetchPolicy, query: query, notifyOnNetworkStatusChange: false, nextFetchPolicy: void 0 });
|
|
868
|
-
if (
|
|
853
|
+
if (globalThis.__DEV__ !== false) {
|
|
869
854
|
validateOptions(watchQueryOptions);
|
|
870
855
|
}
|
|
871
856
|
if (options.skip) {
|
|
@@ -876,16 +861,25 @@ function useWatchQueryOptions(_a) {
|
|
|
876
861
|
}
|
|
877
862
|
|
|
878
863
|
var QUERY_REFERENCE_SYMBOL = Symbol();
|
|
864
|
+
var OBSERVED_CHANGED_OPTIONS = [
|
|
865
|
+
'canonizeResults',
|
|
866
|
+
'context',
|
|
867
|
+
'errorPolicy',
|
|
868
|
+
'fetchPolicy',
|
|
869
|
+
'refetchWritePolicy',
|
|
870
|
+
'returnPartialData',
|
|
871
|
+
];
|
|
879
872
|
((function () {
|
|
880
873
|
function InternalQueryReference(observable, options) {
|
|
881
874
|
var _this = this;
|
|
882
875
|
var _a;
|
|
883
876
|
this.listeners = new Set();
|
|
884
|
-
this.
|
|
885
|
-
this.
|
|
877
|
+
this.status = 'loading';
|
|
878
|
+
this.references = 0;
|
|
886
879
|
this.listen = this.listen.bind(this);
|
|
887
880
|
this.handleNext = this.handleNext.bind(this);
|
|
888
881
|
this.handleError = this.handleError.bind(this);
|
|
882
|
+
this.initiateFetch = this.initiateFetch.bind(this);
|
|
889
883
|
this.dispose = this.dispose.bind(this);
|
|
890
884
|
this.observable = observable;
|
|
891
885
|
this.result = observable.getCurrentResult(false);
|
|
@@ -895,21 +889,25 @@ var QUERY_REFERENCE_SYMBOL = Symbol();
|
|
|
895
889
|
}
|
|
896
890
|
if (core.isNetworkRequestSettled(this.result.networkStatus) ||
|
|
897
891
|
(this.result.data &&
|
|
898
|
-
(!this.result.partial || this.
|
|
892
|
+
(!this.result.partial || this.watchQueryOptions.returnPartialData))) {
|
|
899
893
|
this.promise = utilities.createFulfilledPromise(this.result);
|
|
900
|
-
this.
|
|
901
|
-
this.refetching = false;
|
|
894
|
+
this.status = 'idle';
|
|
902
895
|
}
|
|
903
|
-
|
|
904
|
-
next: this.handleNext,
|
|
905
|
-
error: this.handleError,
|
|
906
|
-
});
|
|
907
|
-
if (!this.promise) {
|
|
896
|
+
else {
|
|
908
897
|
this.promise = new Promise(function (resolve, reject) {
|
|
909
898
|
_this.resolve = resolve;
|
|
910
899
|
_this.reject = reject;
|
|
911
900
|
});
|
|
912
901
|
}
|
|
902
|
+
this.subscription = observable
|
|
903
|
+
.filter(function (_a) {
|
|
904
|
+
var data = _a.data;
|
|
905
|
+
return !equality.equal(data, {});
|
|
906
|
+
})
|
|
907
|
+
.subscribe({
|
|
908
|
+
next: this.handleNext,
|
|
909
|
+
error: this.handleError,
|
|
910
|
+
});
|
|
913
911
|
this.autoDisposeTimeoutId = setTimeout(this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);
|
|
914
912
|
}
|
|
915
913
|
Object.defineProperty(InternalQueryReference.prototype, "watchQueryOptions", {
|
|
@@ -919,28 +917,61 @@ var QUERY_REFERENCE_SYMBOL = Symbol();
|
|
|
919
917
|
enumerable: false,
|
|
920
918
|
configurable: true
|
|
921
919
|
});
|
|
922
|
-
InternalQueryReference.prototype.
|
|
920
|
+
InternalQueryReference.prototype.retain = function () {
|
|
923
921
|
var _this = this;
|
|
922
|
+
this.references++;
|
|
924
923
|
clearTimeout(this.autoDisposeTimeoutId);
|
|
924
|
+
var disposed = false;
|
|
925
|
+
return function () {
|
|
926
|
+
if (disposed) {
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
disposed = true;
|
|
930
|
+
_this.references--;
|
|
931
|
+
setTimeout(function () {
|
|
932
|
+
if (!_this.references) {
|
|
933
|
+
_this.dispose();
|
|
934
|
+
}
|
|
935
|
+
});
|
|
936
|
+
};
|
|
937
|
+
};
|
|
938
|
+
InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) {
|
|
939
|
+
var _this = this;
|
|
940
|
+
return OBSERVED_CHANGED_OPTIONS.some(function (option) {
|
|
941
|
+
return !equality.equal(_this.watchQueryOptions[option], watchQueryOptions[option]);
|
|
942
|
+
});
|
|
943
|
+
};
|
|
944
|
+
InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) {
|
|
945
|
+
var _a = this.watchQueryOptions, currentFetchPolicy = _a.fetchPolicy, currentCanonizeResults = _a.canonizeResults;
|
|
946
|
+
if (currentFetchPolicy === 'standby' &&
|
|
947
|
+
currentFetchPolicy !== watchQueryOptions.fetchPolicy) {
|
|
948
|
+
this.observable.reobserve(watchQueryOptions);
|
|
949
|
+
this.initiateFetch();
|
|
950
|
+
}
|
|
951
|
+
else {
|
|
952
|
+
this.observable.silentSetOptions(watchQueryOptions);
|
|
953
|
+
if (currentCanonizeResults !== watchQueryOptions.canonizeResults) {
|
|
954
|
+
this.result = tslib.__assign(tslib.__assign({}, this.result), this.observable.getCurrentResult());
|
|
955
|
+
this.promise = utilities.createFulfilledPromise(this.result);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
return this.promise;
|
|
959
|
+
};
|
|
960
|
+
InternalQueryReference.prototype.listen = function (listener) {
|
|
961
|
+
var _this = this;
|
|
925
962
|
this.listeners.add(listener);
|
|
926
963
|
return function () {
|
|
927
964
|
_this.listeners.delete(listener);
|
|
928
965
|
};
|
|
929
966
|
};
|
|
930
967
|
InternalQueryReference.prototype.refetch = function (variables) {
|
|
931
|
-
this.refetching = true;
|
|
932
968
|
var promise = this.observable.refetch(variables);
|
|
933
|
-
this.
|
|
969
|
+
this.initiateFetch();
|
|
934
970
|
return promise;
|
|
935
971
|
};
|
|
936
972
|
InternalQueryReference.prototype.fetchMore = function (options) {
|
|
937
973
|
var promise = this.observable.fetchMore(options);
|
|
938
|
-
this.
|
|
939
|
-
return promise;
|
|
940
|
-
};
|
|
941
|
-
InternalQueryReference.prototype.reobserve = function (watchQueryOptions) {
|
|
942
|
-
var promise = this.observable.reobserve(watchQueryOptions);
|
|
943
|
-
this.promise = promise;
|
|
974
|
+
this.initiateFetch();
|
|
944
975
|
return promise;
|
|
945
976
|
};
|
|
946
977
|
InternalQueryReference.prototype.dispose = function () {
|
|
@@ -950,48 +981,57 @@ var QUERY_REFERENCE_SYMBOL = Symbol();
|
|
|
950
981
|
InternalQueryReference.prototype.onDispose = function () {
|
|
951
982
|
};
|
|
952
983
|
InternalQueryReference.prototype.handleNext = function (result) {
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
984
|
+
var _a;
|
|
985
|
+
switch (this.status) {
|
|
986
|
+
case 'loading': {
|
|
987
|
+
if (result.data === void 0) {
|
|
988
|
+
result.data = this.result.data;
|
|
989
|
+
}
|
|
990
|
+
this.status = 'idle';
|
|
991
|
+
this.result = result;
|
|
992
|
+
(_a = this.resolve) === null || _a === void 0 ? void 0 : _a.call(this, result);
|
|
993
|
+
break;
|
|
959
994
|
}
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
995
|
+
case 'idle': {
|
|
996
|
+
if (result.data === this.result.data) {
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
999
|
+
if (result.data === void 0) {
|
|
1000
|
+
result.data = this.result.data;
|
|
1001
|
+
}
|
|
1002
|
+
this.result = result;
|
|
1003
|
+
this.promise = utilities.createFulfilledPromise(result);
|
|
1004
|
+
this.deliver(this.promise);
|
|
1005
|
+
break;
|
|
965
1006
|
}
|
|
966
|
-
return;
|
|
967
|
-
}
|
|
968
|
-
if (result.data === this.result.data) {
|
|
969
|
-
return;
|
|
970
1007
|
}
|
|
971
|
-
this.result = result;
|
|
972
|
-
this.promise = utilities.createFulfilledPromise(result);
|
|
973
|
-
this.deliver(this.promise);
|
|
974
1008
|
};
|
|
975
1009
|
InternalQueryReference.prototype.handleError = function (error) {
|
|
976
|
-
var
|
|
977
|
-
this.
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1010
|
+
var _a;
|
|
1011
|
+
switch (this.status) {
|
|
1012
|
+
case 'loading': {
|
|
1013
|
+
this.status = 'idle';
|
|
1014
|
+
(_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this, error);
|
|
1015
|
+
break;
|
|
1016
|
+
}
|
|
1017
|
+
case 'idle': {
|
|
1018
|
+
this.promise = utilities.createRejectedPromise(error);
|
|
1019
|
+
this.deliver(this.promise);
|
|
983
1020
|
}
|
|
984
|
-
return;
|
|
985
1021
|
}
|
|
986
|
-
this.result = result;
|
|
987
|
-
this.promise = result.data
|
|
988
|
-
? utilities.createFulfilledPromise(result)
|
|
989
|
-
: utilities.createRejectedPromise(result);
|
|
990
|
-
this.deliver(this.promise);
|
|
991
1022
|
};
|
|
992
1023
|
InternalQueryReference.prototype.deliver = function (promise) {
|
|
993
1024
|
this.listeners.forEach(function (listener) { return listener(promise); });
|
|
994
1025
|
};
|
|
1026
|
+
InternalQueryReference.prototype.initiateFetch = function () {
|
|
1027
|
+
var _this = this;
|
|
1028
|
+
this.status = 'loading';
|
|
1029
|
+
this.promise = new Promise(function (resolve, reject) {
|
|
1030
|
+
_this.resolve = resolve;
|
|
1031
|
+
_this.reject = reject;
|
|
1032
|
+
});
|
|
1033
|
+
this.promise.catch(function () { });
|
|
1034
|
+
};
|
|
995
1035
|
return InternalQueryReference;
|
|
996
1036
|
})());
|
|
997
1037
|
|
|
@@ -1000,35 +1040,34 @@ function useBackgroundQuery(query, options) {
|
|
|
1000
1040
|
var suspenseCache = useSuspenseCache(options.suspenseCache);
|
|
1001
1041
|
var client = useApolloClient(options.client);
|
|
1002
1042
|
var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options });
|
|
1003
|
-
var
|
|
1043
|
+
var variables = watchQueryOptions.variables;
|
|
1004
1044
|
var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
|
|
1005
1045
|
var cacheKey = [client, query, cache.canonicalStringify(variables)].concat(queryKey);
|
|
1006
1046
|
var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
|
|
1007
1047
|
return client.watchQuery(watchQueryOptions);
|
|
1008
1048
|
});
|
|
1009
|
-
var
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
var promise = queryRef.reobserve({ fetchPolicy: fetchPolicy });
|
|
1049
|
+
var _b = React__namespace.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
|
|
1050
|
+
if (queryRef.didChangeOptions(watchQueryOptions)) {
|
|
1051
|
+
var promise = queryRef.applyOptions(watchQueryOptions);
|
|
1013
1052
|
promiseCache.set(queryRef.key, promise);
|
|
1014
1053
|
}
|
|
1015
|
-
|
|
1016
|
-
var fetchMore =
|
|
1054
|
+
React__namespace.useEffect(function () { return queryRef.retain(); }, [queryRef]);
|
|
1055
|
+
var fetchMore = React__namespace.useCallback(function (options) {
|
|
1017
1056
|
var promise = queryRef.fetchMore(options);
|
|
1018
1057
|
setPromiseCache(function (promiseCache) {
|
|
1019
|
-
return new Map(promiseCache).set(queryRef.key, promise);
|
|
1058
|
+
return new Map(promiseCache).set(queryRef.key, queryRef.promise);
|
|
1020
1059
|
});
|
|
1021
1060
|
return promise;
|
|
1022
1061
|
}, [queryRef]);
|
|
1023
|
-
var refetch =
|
|
1062
|
+
var refetch = React__namespace.useCallback(function (variables) {
|
|
1024
1063
|
var promise = queryRef.refetch(variables);
|
|
1025
1064
|
setPromiseCache(function (promiseCache) {
|
|
1026
|
-
return new Map(promiseCache).set(queryRef.key, promise);
|
|
1065
|
+
return new Map(promiseCache).set(queryRef.key, queryRef.promise);
|
|
1027
1066
|
});
|
|
1028
1067
|
return promise;
|
|
1029
1068
|
}, [queryRef]);
|
|
1030
1069
|
queryRef.promiseCache = promiseCache;
|
|
1031
|
-
return
|
|
1070
|
+
return React__namespace.useMemo(function () {
|
|
1032
1071
|
var _a;
|
|
1033
1072
|
return [
|
|
1034
1073
|
(_a = {}, _a[QUERY_REFERENCE_SYMBOL] = queryRef, _a),
|
|
@@ -1041,10 +1080,10 @@ function useBackgroundQuery(query, options) {
|
|
|
1041
1080
|
}
|
|
1042
1081
|
|
|
1043
1082
|
function useReadQuery(queryRef) {
|
|
1044
|
-
var _a =
|
|
1083
|
+
var _a = React__namespace.useState(0), forceUpdate = _a[1];
|
|
1045
1084
|
var internalQueryRef = queryRef[QUERY_REFERENCE_SYMBOL];
|
|
1046
|
-
invariant__default(internalQueryRef.promiseCache,
|
|
1047
|
-
var skipResult =
|
|
1085
|
+
invariant__default(internalQueryRef.promiseCache, 49);
|
|
1086
|
+
var skipResult = React__namespace.useMemo(function () {
|
|
1048
1087
|
var error = toApolloError(internalQueryRef.result);
|
|
1049
1088
|
return {
|
|
1050
1089
|
loading: false,
|
|
@@ -1058,7 +1097,7 @@ function useReadQuery(queryRef) {
|
|
|
1058
1097
|
promise = internalQueryRef.promise;
|
|
1059
1098
|
internalQueryRef.promiseCache.set(internalQueryRef.key, promise);
|
|
1060
1099
|
}
|
|
1061
|
-
|
|
1100
|
+
React__namespace.useEffect(function () {
|
|
1062
1101
|
return internalQueryRef.listen(function (promise) {
|
|
1063
1102
|
internalQueryRef.promiseCache.set(internalQueryRef.key, promise);
|
|
1064
1103
|
forceUpdate(function (prevState) { return prevState + 1; });
|
|
@@ -1067,7 +1106,7 @@ function useReadQuery(queryRef) {
|
|
|
1067
1106
|
var result = internalQueryRef.watchQueryOptions.fetchPolicy === 'standby'
|
|
1068
1107
|
? skipResult
|
|
1069
1108
|
: __use(promise);
|
|
1070
|
-
return
|
|
1109
|
+
return React__namespace.useMemo(function () {
|
|
1071
1110
|
return {
|
|
1072
1111
|
data: result.data,
|
|
1073
1112
|
networkStatus: result.networkStatus,
|