@apollo/client 4.3.0-alpha.4 → 4.3.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/README.md +3 -7
  3. package/__cjs/cache/core/cache.cjs +1 -1
  4. package/__cjs/cache/core/cache.cjs.map +1 -1
  5. package/__cjs/cache/core/cache.d.cts +5 -1
  6. package/__cjs/cache/inmemory/entityStore.cjs +3 -3
  7. package/__cjs/cache/inmemory/inMemoryCache.cjs +0 -4
  8. package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  9. package/__cjs/cache/inmemory/inMemoryCache.d.cts +3 -4
  10. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  11. package/__cjs/cache/inmemory/policies.cjs +28 -6
  12. package/__cjs/cache/inmemory/policies.cjs.map +1 -1
  13. package/__cjs/cache/inmemory/readFromStore.cjs +71 -54
  14. package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
  15. package/__cjs/cache/inmemory/readFromStore.d.cts +1 -1
  16. package/__cjs/cache/inmemory/types.d.cts +1 -2
  17. package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
  18. package/__cjs/core/ApolloClient.cjs +21 -22
  19. package/__cjs/core/ApolloClient.cjs.map +1 -1
  20. package/__cjs/core/ApolloClient.d.cts +44 -10
  21. package/__cjs/core/ObservableQuery.cjs +56 -14
  22. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  23. package/__cjs/core/ObservableQuery.d.cts +13 -2
  24. package/__cjs/core/QueryInfo.cjs +175 -161
  25. package/__cjs/core/QueryInfo.cjs.map +1 -1
  26. package/__cjs/core/QueryInfo.d.cts +15 -5
  27. package/__cjs/core/QueryManager.cjs +63 -38
  28. package/__cjs/core/QueryManager.cjs.map +1 -1
  29. package/__cjs/core/RefetchEventManager.cjs +3 -3
  30. package/__cjs/core/dataStateErrorCache.cjs +12 -0
  31. package/__cjs/core/dataStateErrorCache.cjs.map +1 -0
  32. package/__cjs/core/dataStateErrorCache.d.cts +3 -0
  33. package/__cjs/core/types.d.cts +2 -0
  34. package/__cjs/incremental/handlers/graphql17Alpha9.cjs +34 -11
  35. package/__cjs/incremental/handlers/graphql17Alpha9.cjs.map +1 -1
  36. package/__cjs/incremental/handlers/graphql17Alpha9.d.cts +26 -3
  37. package/__cjs/incremental/types.d.cts +41 -3
  38. package/__cjs/invariantErrorCodes.cjs +56 -32
  39. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  40. package/__cjs/react/hooks/useBackgroundQuery.d.cts +100 -47
  41. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  42. package/__cjs/react/hooks/useLazyQuery.d.cts +26 -20
  43. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  44. package/__cjs/react/hooks/useLoadableQuery.d.cts +23 -15
  45. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  46. package/__cjs/react/hooks/useMutation.d.cts +10 -7
  47. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  48. package/__cjs/react/hooks/useQuery.d.cts +74 -32
  49. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  50. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  51. package/__cjs/react/hooks/useSuspenseQuery.d.cts +83 -34
  52. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  53. package/__cjs/react/internal/types.d.cts +14 -3
  54. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  55. package/__cjs/react/query-preloader/createQueryPreloader.d.cts +20 -5
  56. package/__cjs/testing/core/mocking/mockLink.cjs +21 -1
  57. package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
  58. package/__cjs/testing/core/mocking/mockLink.d.cts +1 -2
  59. package/__cjs/utilities/internal/addDeferFragmentLabels.cjs +33 -0
  60. package/__cjs/utilities/internal/addDeferFragmentLabels.cjs.map +1 -0
  61. package/__cjs/utilities/internal/addDeferFragmentLabels.d.cts +3 -0
  62. package/__cjs/utilities/internal/getDirectiveArgValue.cjs +19 -0
  63. package/__cjs/utilities/internal/getDirectiveArgValue.cjs.map +1 -0
  64. package/__cjs/utilities/internal/getDirectiveArgValue.d.cts +9 -0
  65. package/__cjs/utilities/internal/index.cjs +8 -2
  66. package/__cjs/utilities/internal/index.cjs.map +1 -1
  67. package/__cjs/utilities/internal/index.d.cts +3 -0
  68. package/__cjs/utilities/internal/toDiffWithDataState.cjs +20 -0
  69. package/__cjs/utilities/internal/toDiffWithDataState.cjs.map +1 -0
  70. package/__cjs/utilities/internal/toDiffWithDataState.d.cts +8 -0
  71. package/__cjs/version.cjs +1 -1
  72. package/cache/core/cache.d.ts +5 -1
  73. package/cache/core/cache.js +1 -1
  74. package/cache/core/cache.js.map +1 -1
  75. package/cache/inmemory/entityStore.js +3 -3
  76. package/cache/inmemory/inMemoryCache.d.ts +3 -4
  77. package/cache/inmemory/inMemoryCache.js +1 -5
  78. package/cache/inmemory/inMemoryCache.js.map +1 -1
  79. package/cache/inmemory/key-extractor.js +1 -1
  80. package/cache/inmemory/policies.js +28 -6
  81. package/cache/inmemory/policies.js.map +1 -1
  82. package/cache/inmemory/readFromStore.d.ts +1 -1
  83. package/cache/inmemory/readFromStore.js +72 -55
  84. package/cache/inmemory/readFromStore.js.map +1 -1
  85. package/cache/inmemory/types.d.ts +1 -2
  86. package/cache/inmemory/types.js.map +1 -1
  87. package/cache/inmemory/writeToStore.js +4 -4
  88. package/core/ApolloClient.d.ts +44 -10
  89. package/core/ApolloClient.js +21 -22
  90. package/core/ApolloClient.js.map +1 -1
  91. package/core/ObservableQuery.d.ts +13 -2
  92. package/core/ObservableQuery.js +57 -15
  93. package/core/ObservableQuery.js.map +1 -1
  94. package/core/QueryInfo.d.ts +15 -5
  95. package/core/QueryInfo.js +171 -161
  96. package/core/QueryInfo.js.map +1 -1
  97. package/core/QueryManager.js +63 -38
  98. package/core/QueryManager.js.map +1 -1
  99. package/core/RefetchEventManager.js +3 -3
  100. package/core/dataStateErrorCache.d.ts +3 -0
  101. package/core/dataStateErrorCache.js +9 -0
  102. package/core/dataStateErrorCache.js.map +1 -0
  103. package/core/types.d.ts +2 -0
  104. package/core/types.js.map +1 -1
  105. package/incremental/handlers/graphql17Alpha9.d.ts +26 -3
  106. package/incremental/handlers/graphql17Alpha9.js +35 -12
  107. package/incremental/handlers/graphql17Alpha9.js.map +1 -1
  108. package/incremental/types.d.ts +41 -3
  109. package/incremental/types.js.map +1 -1
  110. package/invariantErrorCodes.js +56 -32
  111. package/package.json +1 -1
  112. package/react/hooks/useBackgroundQuery.d.ts +100 -47
  113. package/react/hooks/useBackgroundQuery.js.map +1 -1
  114. package/react/hooks/useLazyQuery.d.ts +26 -20
  115. package/react/hooks/useLazyQuery.js.map +1 -1
  116. package/react/hooks/useLoadableQuery.d.ts +23 -15
  117. package/react/hooks/useLoadableQuery.js.map +1 -1
  118. package/react/hooks/useMutation.d.ts +10 -7
  119. package/react/hooks/useMutation.js.map +1 -1
  120. package/react/hooks/useQuery.d.ts +74 -32
  121. package/react/hooks/useQuery.js.map +1 -1
  122. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  123. package/react/hooks/useSuspenseQuery.d.ts +83 -34
  124. package/react/hooks/useSuspenseQuery.js.map +1 -1
  125. package/react/hooks-compiled/useBackgroundQuery.d.ts +100 -47
  126. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  127. package/react/hooks-compiled/useLazyQuery.d.ts +26 -20
  128. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  129. package/react/hooks-compiled/useLoadableQuery.d.ts +23 -15
  130. package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
  131. package/react/hooks-compiled/useMutation.d.ts +10 -7
  132. package/react/hooks-compiled/useMutation.js.map +1 -1
  133. package/react/hooks-compiled/useQuery.d.ts +74 -32
  134. package/react/hooks-compiled/useQuery.js.map +1 -1
  135. package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
  136. package/react/hooks-compiled/useSuspenseQuery.d.ts +83 -34
  137. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  138. package/react/internal/cache/QueryReference.js.map +1 -1
  139. package/react/internal/types.d.ts +15 -4
  140. package/react/internal/types.js.map +1 -1
  141. package/react/query-preloader/createQueryPreloader.d.ts +20 -5
  142. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  143. package/testing/core/mocking/mockLink.d.ts +1 -2
  144. package/testing/core/mocking/mockLink.js +21 -1
  145. package/testing/core/mocking/mockLink.js.map +1 -1
  146. package/utilities/internal/addDeferFragmentLabels.d.ts +3 -0
  147. package/utilities/internal/addDeferFragmentLabels.js +30 -0
  148. package/utilities/internal/addDeferFragmentLabels.js.map +1 -0
  149. package/utilities/internal/getDirectiveArgValue.d.ts +9 -0
  150. package/utilities/internal/getDirectiveArgValue.js +16 -0
  151. package/utilities/internal/getDirectiveArgValue.js.map +1 -0
  152. package/utilities/internal/index.d.ts +3 -0
  153. package/utilities/internal/index.js +3 -0
  154. package/utilities/internal/index.js.map +1 -1
  155. package/utilities/internal/toDiffWithDataState.d.ts +8 -0
  156. package/utilities/internal/toDiffWithDataState.js +17 -0
  157. package/utilities/internal/toDiffWithDataState.js.map +1 -0
  158. package/version.js +1 -1
@@ -8,7 +8,7 @@ import type { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
8
8
  import type { LocalState } from "@apollo/client/local-state";
9
9
  import type { MaybeMasked, Unmasked } from "@apollo/client/masking";
10
10
  import { DocumentTransform } from "@apollo/client/utilities";
11
- import type { LazyType, OptionWithFallback, SignatureStyle, VariablesOption, variablesUnknownSymbol } from "@apollo/client/utilities/internal";
11
+ import type { LazyType, OptionWithFallback, Prettify, SignatureStyle, VariablesOption, variablesUnknownSymbol } from "@apollo/client/utilities/internal";
12
12
  import { getApolloClientMemoryInternals } from "@apollo/client/utilities/internal";
13
13
  import type { DeclareDefaultOptions, DefaultOptions } from "./defaultOptions.cjs";
14
14
  import type { ObservableQuery } from "./ObservableQuery.cjs";
@@ -232,7 +232,20 @@ export declare namespace ApolloClient {
232
232
  export namespace mutate {
233
233
  interface DefaultOptions extends ApolloClient.DefaultOptions.Mutate.Calculated {
234
234
  }
235
- type ResultForOptions<TData, TVariables extends OperationVariables, TCache extends Cache.Implementation, TOptions extends Record<string, unknown> | MutateOptions<any, TVariables, TCache>> = LazyType<MutateResult<MaybeMasked<TData>, OptionWithFallback<TOptions, DefaultOptions, "errorPolicy"> & ErrorPolicy>>;
235
+ type OptionsFor<TData, TVariables extends OperationVariables, TCache extends Cache.Implementation, TOptions extends {
236
+ variables?: unknown;
237
+ }> = MutateOptions<NoInfer<TData>, NoInfer<TVariables>, TCache> & {
238
+ variables?: Prettify<TVariables & {
239
+ [K in keyof TOptions["variables"]]: K extends keyof TVariables ? TVariables[K] : never;
240
+ }>;
241
+ } & (Exclude<keyof TOptions, keyof MutateOptions<any, any, any>> extends (infer InvalidOptionNames extends string) ? [
242
+ InvalidOptionNames
243
+ ] extends [never] ? unknown : {
244
+ [K in InvalidOptionNames]: never;
245
+ } : never);
246
+ type ResultForOptions<TData, TErrorPolicy extends ErrorPolicy | undefined = undefined> = LazyType<MutateResult<MaybeMasked<TData>, OptionWithFallback<{
247
+ errorPolicy: TErrorPolicy;
248
+ }, DefaultOptions, "errorPolicy"> & ErrorPolicy>>;
236
249
  namespace Signatures {
237
250
  interface Classic {
238
251
  /**
@@ -271,11 +284,21 @@ export declare namespace ApolloClient {
271
284
  *
272
285
  * It takes options as an object with the following keys and values:
273
286
  */
274
- <TData, TVariables extends OperationVariables, TOptions extends ApolloClient.MutateOptions<NoInfer<TData>, NoInfer<TVariables>, Cache.Implementation> & VariablesOption<TVariables & {
275
- [K in Exclude<keyof TOptions["variables"], keyof TVariables>]?: never;
276
- }>>(options: TOptions & {
287
+ <TData, TVariables extends OperationVariables, TOptions extends Omit<ApolloClient.MutateOptions<NoInfer<TData>, any, Cache.Implementation>, "variables"> & {
288
+ variables?: unknown;
289
+ }, TErrorPolicy extends ErrorPolicy | undefined = undefined>(options: TOptions & ApolloClient.mutate.OptionsFor<TData, TVariables, Cache.Implementation, TOptions> & {
277
290
  mutation: TypedDocumentNode<TData, TVariables>;
278
- }): Promise<ApolloClient.mutate.ResultForOptions<TData, TVariables, Cache.Implementation, TOptions>>;
291
+ /**
292
+ * Specifies how the mutation handles a response that returns both GraphQL errors and partial results.
293
+ *
294
+ * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
295
+ *
296
+ * The default value is `none`, meaning that the mutation result includes error details but _not_ partial results.
297
+ *
298
+ * @docGroup 1. Operation options
299
+ */
300
+ errorPolicy?: TErrorPolicy;
301
+ }): Promise<ApolloClient.mutate.ResultForOptions<TData, TErrorPolicy>>;
279
302
  }
280
303
  type Evaluated = SignatureStyle extends "classic" ? Classic : Modern;
281
304
  }
@@ -473,7 +496,18 @@ export declare namespace ApolloClient {
473
496
  export namespace query {
474
497
  interface DefaultOptions extends ApolloClient.DefaultOptions.Query.Calculated {
475
498
  }
476
- type ResultForOptions<TData, TVariables extends OperationVariables, TOptions extends Record<string, unknown> | QueryOptions<any, TVariables>> = LazyType<QueryResult<MaybeMasked<TData>, OptionWithFallback<TOptions, DefaultOptions, "errorPolicy"> & ErrorPolicy>>;
499
+ type OptionsFor<TData, TVariables extends OperationVariables, TOptions extends {
500
+ variables?: unknown;
501
+ }> = QueryOptions<NoInfer<TData>, NoInfer<TVariables>> & {
502
+ variables?: Prettify<TVariables & {
503
+ [K in keyof TOptions["variables"]]: K extends keyof TVariables ? TVariables[K] : never;
504
+ }>;
505
+ } & (Exclude<keyof TOptions, keyof QueryOptions<any, any>> extends (infer InvalidOptionNames extends string) ? [
506
+ InvalidOptionNames
507
+ ] extends [never] ? unknown : {
508
+ [K in InvalidOptionNames]: never;
509
+ } : never);
510
+ type ResultForOptions<TData, TVariables extends OperationVariables, TOptions extends Record<string, unknown> | Omit<QueryOptions<any, any>, "variables">> = LazyType<QueryResult<MaybeMasked<TData>, OptionWithFallback<TOptions, DefaultOptions, "errorPolicy"> & ErrorPolicy>>;
477
511
  namespace Signatures {
478
512
  interface Classic {
479
513
  /**
@@ -515,9 +549,9 @@ export declare namespace ApolloClient {
515
549
  * describe how this query should be treated e.g. whether it should hit the
516
550
  * server at all or just resolve from the cache, etc.
517
551
  */
518
- <TData, TVariables extends OperationVariables, TOptions extends ApolloClient.QueryOptions<NoInfer<TData>, NoInfer<TVariables>> & VariablesOption<TVariables & {
519
- [K in Exclude<keyof TOptions["variables"], keyof TVariables>]?: never;
520
- }>>(options: TOptions & {
552
+ <TData, TVariables extends OperationVariables, TOptions extends Omit<ApolloClient.QueryOptions<NoInfer<TData>, any>, "variables"> & {
553
+ variables?: unknown;
554
+ }>(options: TOptions & ApolloClient.query.OptionsFor<TData, TVariables, TOptions> & {
521
555
  query: TypedDocumentNode<TData, TVariables>;
522
556
  }): Promise<ApolloClient.query.ResultForOptions<TData, TVariables, TOptions>>;
523
557
  }
@@ -12,6 +12,7 @@ const utilities_1 = require("@apollo/client/utilities");
12
12
  const environment_1 = require("@apollo/client/utilities/environment");
13
13
  const internal_1 = require("@apollo/client/utilities/internal");
14
14
  const invariant_1 = require("@apollo/client/utilities/invariant");
15
+ const dataStateErrorCache_js_1 = require("./dataStateErrorCache.cjs");
15
16
  const networkStatus_js_1 = require("./networkStatus.cjs");
16
17
  const { assign, hasOwnProperty } = Object;
17
18
  const uninitialized = {
@@ -213,12 +214,13 @@ class ObservableQuery {
213
214
  * @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
214
215
  */
215
216
  getCacheDiff({ optimistic = true } = {}) {
216
- return this.cache.diff({
217
+ return (0, internal_1.toDiffWithDataState)(this.cache.diff({
217
218
  query: this.query,
218
219
  variables: this.variables,
219
220
  returnPartialData: true,
220
221
  optimistic,
221
- });
222
+ [internal_1.handleIncrementalSymbol]: undefined,
223
+ }));
222
224
  }
223
225
  getInitialResult(initialFetchPolicy) {
224
226
  let fetchPolicy = initialFetchPolicy || this.options.fetchPolicy;
@@ -228,16 +230,18 @@ class ObservableQuery {
228
230
  }
229
231
  const cacheResult = () => {
230
232
  const diff = this.getCacheDiff();
233
+ let { dataState } = diff;
231
234
  // TODO: queryInfo.getDiff should handle this since cache.diff returns a
232
235
  // null when returnPartialData is false
233
236
  const data = this.options.returnPartialData || diff.complete ?
234
237
  diff.result ?? undefined
235
238
  : undefined;
239
+ if (data === undefined) {
240
+ dataState = "empty";
241
+ }
236
242
  return this.maskResult({
237
243
  data,
238
- dataState: diff.complete ? "complete"
239
- : data === undefined ? "empty"
240
- : "partial",
244
+ dataState,
241
245
  loading: !diff.complete,
242
246
  networkStatus: diff.complete ? networkStatus_js_1.NetworkStatus.ready : networkStatus_js_1.NetworkStatus.loading,
243
247
  partial: !diff.complete,
@@ -886,6 +890,7 @@ class ObservableQuery {
886
890
  if (this.pollingInfo) {
887
891
  if (!(0, utilities_1.isNetworkRequestInFlight)(this.networkStatus) &&
888
892
  !this.options.skipPollAttempt?.()) {
893
+ this._lastWrite = undefined;
889
894
  this._reobserve({
890
895
  // Most fetchPolicy options don't make sense to use in a polling context, as
891
896
  // users wouldn't want to be polling the cache directly. However, network-only and
@@ -1162,9 +1167,7 @@ class ObservableQuery {
1162
1167
  kind: "N",
1163
1168
  value: {
1164
1169
  data: diff.result,
1165
- dataState: diff.complete ? "complete"
1166
- : diff.result ? "partial"
1167
- : "empty",
1170
+ dataState: diff.dataState,
1168
1171
  networkStatus: networkStatus_js_1.NetworkStatus.ready,
1169
1172
  loading: false,
1170
1173
  error: undefined,
@@ -1260,19 +1263,55 @@ class ObservableQuery {
1260
1263
  });
1261
1264
  }
1262
1265
  operator = (0, internal_1.filterMap)((notification) => {
1263
- const { query, variables, meta } = notification;
1266
+ const { query, meta } = notification;
1264
1267
  if (notification.source === "setResult") {
1265
- return { query, variables, result: notification.value, meta };
1268
+ return {
1269
+ query,
1270
+ variables: this.variables,
1271
+ result: notification.value,
1272
+ meta,
1273
+ };
1274
+ }
1275
+ if (notification.kind === "C") {
1276
+ return;
1266
1277
  }
1267
- if (notification.kind === "C" || !isEqualQuery(notification, this)) {
1278
+ const resolvedVariables = "resolvedVariables" in notification ?
1279
+ notification.resolvedVariables
1280
+ : undefined;
1281
+ // Usually we prefer to drop notifications that don't match this query
1282
+ // but this breaks when used with `@export` queries that resolve variables
1283
+ // after the request is initiated. `notification.resolvedVariables` gives us
1284
+ // the variables the query actually resolved with during evaluation in
1285
+ // QueryManager (which is the variables value after `@export` variables have
1286
+ // been applied), but we need to update this query with those resolved
1287
+ // variables maybe in the middle of a request (updating is handled below).
1288
+ // When we update this.variables to the resolved variables, this causes
1289
+ // isEqualQuery(notification, this) to fail for future notifications since
1290
+ // the notification.variables holds the stale variables value. In this case,
1291
+ // we want to allow the notification through only if the current variables
1292
+ // value matches the resolved variables.
1293
+ //
1294
+ // Note: the check for matching resolved variables typically kicks in for
1295
+ // multi-emission fetches (such as defer, or cache-and-network, etc).
1296
+ if (notification.query !== this.query) {
1268
1297
  return;
1269
1298
  }
1299
+ if (!(0, equality_1.equal)(resolvedVariables, this.variables)) {
1300
+ if (!(0, equality_1.equal)(notification.variables, this.variables)) {
1301
+ return;
1302
+ }
1303
+ if (resolvedVariables) {
1304
+ this.options.variables = resolvedVariables;
1305
+ this.resubscribeCache();
1306
+ }
1307
+ }
1308
+ const variables = this.variables;
1270
1309
  let result;
1271
1310
  const previous = this.subject.getValue();
1272
1311
  if (notification.source === "cache") {
1273
1312
  result = notification.value;
1274
1313
  if (result.networkStatus === networkStatus_js_1.NetworkStatus.ready &&
1275
- result.partial &&
1314
+ result.dataState === "partial" &&
1276
1315
  (!this.options.returnPartialData ||
1277
1316
  previous.result.networkStatus === networkStatus_js_1.NetworkStatus.error) &&
1278
1317
  this.options.fetchPolicy !== "cache-only") {
@@ -1287,7 +1326,9 @@ class ObservableQuery {
1287
1326
  result =
1288
1327
  notification.kind === "E" ?
1289
1328
  {
1290
- ...(isEqualQuery(previous, notification) ?
1329
+ ...((isEqualQuery(previous, notification) ||
1330
+ (resolvedVariables &&
1331
+ (0, equality_1.equal)(resolvedVariables, previous.variables))) ?
1291
1332
  previous.result
1292
1333
  : { data: undefined, dataState: "empty", partial: true }),
1293
1334
  error: notification.error,
@@ -1296,7 +1337,8 @@ class ObservableQuery {
1296
1337
  }
1297
1338
  : notification.value;
1298
1339
  if (notification.kind === "E" && result.dataState === "streaming") {
1299
- result.dataState = "complete";
1340
+ result.dataState =
1341
+ dataStateErrorCache_js_1.dataStateErrorCache.get(notification.error) ?? "complete";
1300
1342
  }
1301
1343
  if (result.error) {
1302
1344
  meta.shouldEmit = 1 /* EmitBehavior.force */;