@apollo/client 4.2.0-alpha.3 → 4.2.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +179 -0
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/policies.cjs +4 -4
- package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/core/ApolloClient.cjs +43 -11
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +28 -1
- package/__cjs/core/ObservableQuery.cjs +7 -7
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +20 -1
- package/__cjs/core/QueryManager.cjs +12 -12
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/RefetchEventManager.cjs +134 -0
- package/__cjs/core/RefetchEventManager.cjs.map +1 -0
- package/__cjs/core/RefetchEventManager.d.cts +130 -0
- package/__cjs/core/index.cjs +7 -1
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +4 -1
- package/__cjs/core/refetchSources/onlineSource.cjs +10 -0
- package/__cjs/core/refetchSources/onlineSource.cjs.map +1 -0
- package/__cjs/core/refetchSources/onlineSource.d.cts +3 -0
- package/__cjs/core/refetchSources/windowFocusSource.cjs +13 -0
- package/__cjs/core/refetchSources/windowFocusSource.cjs.map +1 -0
- package/__cjs/core/refetchSources/windowFocusSource.d.cts +3 -0
- package/__cjs/core/types.d.cts +20 -0
- package/__cjs/invariantErrorCodes.cjs +69 -44
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.d.cts +20 -1
- package/__cjs/react/hooks/useLazyQuery.cjs +1 -0
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +20 -1
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLoadableQuery.d.cts +20 -1
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +20 -1
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.d.cts +20 -1
- package/__cjs/react/internal/cache/QueryReference.cjs +1 -0
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.d.cts +20 -1
- package/__cjs/react/types/types.documentation.d.cts +19 -0
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.js +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.d.ts +28 -1
- package/core/ApolloClient.js +44 -12
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +20 -1
- package/core/ObservableQuery.js +7 -7
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.js +12 -12
- package/core/QueryManager.js.map +1 -1
- package/core/RefetchEventManager.d.ts +130 -0
- package/core/RefetchEventManager.js +126 -0
- package/core/RefetchEventManager.js.map +1 -0
- package/core/index.d.ts +4 -1
- package/core/index.js +3 -0
- package/core/index.js.map +1 -1
- package/core/refetchSources/onlineSource.d.ts +3 -0
- package/core/refetchSources/onlineSource.js +6 -0
- package/core/refetchSources/onlineSource.js.map +1 -0
- package/core/refetchSources/windowFocusSource.d.ts +3 -0
- package/core/refetchSources/windowFocusSource.js +9 -0
- package/core/refetchSources/windowFocusSource.js.map +1 -0
- package/core/types.d.ts +20 -0
- package/core/types.js.map +1 -1
- package/invariantErrorCodes.js +69 -44
- package/package.json +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +20 -1
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +20 -1
- package/react/hooks/useLazyQuery.js +1 -0
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.d.ts +20 -1
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useQuery.d.ts +20 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +20 -1
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks-compiled/useBackgroundQuery.d.ts +20 -1
- package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.d.ts +20 -1
- package/react/hooks-compiled/useLazyQuery.js +1 -0
- package/react/hooks-compiled/useLazyQuery.js.map +1 -1
- package/react/hooks-compiled/useLoadableQuery.d.ts +20 -1
- package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
- package/react/hooks-compiled/useQuery.d.ts +20 -1
- package/react/hooks-compiled/useQuery.js.map +1 -1
- package/react/hooks-compiled/useSuspenseQuery.d.ts +20 -1
- package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +1 -1
- package/react/internal/cache/QueryReference.js +1 -0
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/query-preloader/createQueryPreloader.d.ts +20 -1
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/types/types.documentation.d.ts +19 -0
- package/react/types/types.documentation.js.map +1 -1
- package/version.js +1 -1
|
@@ -34,7 +34,7 @@ export function keyFieldsFnFromSpecifier(specifier) {
|
|
|
34
34
|
// context.readField for this extraction.
|
|
35
35
|
extracted = extractKeyPath(object, schemaKeyPath, extractKey);
|
|
36
36
|
}
|
|
37
|
-
invariant(extracted !== void 0,
|
|
37
|
+
invariant(extracted !== void 0, 107, schemaKeyPath.join("."), object);
|
|
38
38
|
return extracted;
|
|
39
39
|
}));
|
|
40
40
|
return `${context.typename}:${JSON.stringify(keyObject)}`;
|
|
@@ -220,7 +220,7 @@ export class Policies {
|
|
|
220
220
|
const rootId = "ROOT_" + which.toUpperCase();
|
|
221
221
|
const old = this.rootTypenamesById[rootId];
|
|
222
222
|
if (typename !== old) {
|
|
223
|
-
invariant(!old || old === which,
|
|
223
|
+
invariant(!old || old === which, 108, which);
|
|
224
224
|
// First, delete any old __typename associated with this rootId from
|
|
225
225
|
// rootIdsByTypename.
|
|
226
226
|
if (old)
|
|
@@ -363,7 +363,7 @@ export class Policies {
|
|
|
363
363
|
if (supertypeSet.has(supertype)) {
|
|
364
364
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
365
365
|
if (checkingFuzzySubtypes) {
|
|
366
|
-
__DEV__ && invariant.warn(
|
|
366
|
+
__DEV__ && invariant.warn(109, typename, supertype);
|
|
367
367
|
}
|
|
368
368
|
// Record positive results for faster future lookup.
|
|
369
369
|
// Unfortunately, we cannot safely cache negative results,
|
|
@@ -615,7 +615,7 @@ export function normalizeReadFieldOptions(readFieldArgs, objectOrReference, vari
|
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
617
|
if (__DEV__ && options.from === void 0) {
|
|
618
|
-
__DEV__ && invariant.warn(
|
|
618
|
+
__DEV__ && invariant.warn(110, stringifyForDisplay(Array.from(readFieldArgs)));
|
|
619
619
|
}
|
|
620
620
|
if (void 0 === options.variables) {
|
|
621
621
|
options.variables = variables;
|
|
@@ -625,7 +625,7 @@ export function normalizeReadFieldOptions(readFieldArgs, objectOrReference, vari
|
|
|
625
625
|
function makeMergeObjectsFunction(store) {
|
|
626
626
|
return function mergeObjects(existing, incoming) {
|
|
627
627
|
if (isArray(existing) || isArray(incoming)) {
|
|
628
|
-
throw newInvariantError(
|
|
628
|
+
throw newInvariantError(111);
|
|
629
629
|
}
|
|
630
630
|
// These dynamic checks are necessary because the parameters of a
|
|
631
631
|
// custom merge function can easily have the any type, so the type
|
|
@@ -194,7 +194,7 @@ export class StoreReader {
|
|
|
194
194
|
else {
|
|
195
195
|
const fragment = getFragmentFromSelection(selection, context.lookupFragment);
|
|
196
196
|
if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) {
|
|
197
|
-
throw newInvariantError(
|
|
197
|
+
throw newInvariantError(112, selection.name.value);
|
|
198
198
|
}
|
|
199
199
|
if (fragment && policies.fragmentMatches(fragment, typename)) {
|
|
200
200
|
fragment.selectionSet.selections.forEach(workSet.add, workSet);
|
|
@@ -277,7 +277,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
277
277
|
if (isNonNullObject(value)) {
|
|
278
278
|
invariant(
|
|
279
279
|
!isReference(value),
|
|
280
|
-
|
|
280
|
+
113,
|
|
281
281
|
getTypenameFromStoreObject(store, value),
|
|
282
282
|
field.name.value
|
|
283
283
|
);
|
|
@@ -68,7 +68,7 @@ export class StoreWriter {
|
|
|
68
68
|
path: [],
|
|
69
69
|
});
|
|
70
70
|
if (!isReference(ref)) {
|
|
71
|
-
throw newInvariantError(
|
|
71
|
+
throw newInvariantError(114, result);
|
|
72
72
|
}
|
|
73
73
|
// So far, the store has not been modified, so now it's time to process
|
|
74
74
|
// context.incomingById and merge those incoming fields into context.store.
|
|
@@ -230,7 +230,7 @@ export class StoreWriter {
|
|
|
230
230
|
// provide a default value, so its absence from the written data should
|
|
231
231
|
// not be cause for alarm.
|
|
232
232
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
233
|
-
invariant.error(
|
|
233
|
+
invariant.error(115, resultKeyNameFromField(field), result);
|
|
234
234
|
}
|
|
235
235
|
});
|
|
236
236
|
// Identify the result object, even if dataId was already provided,
|
|
@@ -378,7 +378,7 @@ export class StoreWriter {
|
|
|
378
378
|
else {
|
|
379
379
|
const fragment = getFragmentFromSelection(selection, context.lookupFragment);
|
|
380
380
|
if (!fragment && selection.kind === Kind.FRAGMENT_SPREAD) {
|
|
381
|
-
throw newInvariantError(
|
|
381
|
+
throw newInvariantError(116, selection.name.value);
|
|
382
382
|
}
|
|
383
383
|
if (fragment &&
|
|
384
384
|
policies.fragmentMatches(fragment, typename, result, context.variables)) {
|
|
@@ -550,7 +550,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
550
550
|
}
|
|
551
551
|
});
|
|
552
552
|
}
|
|
553
|
-
__DEV__ && invariant.warn(
|
|
553
|
+
__DEV__ && invariant.warn(117, fieldName, parentType, childTypenames.length ?
|
|
554
554
|
"either ensure all objects of type " +
|
|
555
555
|
childTypenames.join(" and ") +
|
|
556
556
|
" have an ID or a custom merge function, or "
|
package/core/ApolloClient.d.ts
CHANGED
|
@@ -12,7 +12,8 @@ import type { LazyType, OptionWithFallback, SignatureStyle, VariablesOption, var
|
|
|
12
12
|
import { getApolloClientMemoryInternals } from "@apollo/client/utilities/internal";
|
|
13
13
|
import type { DeclareDefaultOptions, DefaultOptions } from "./defaultOptions.js";
|
|
14
14
|
import type { ObservableQuery } from "./ObservableQuery.js";
|
|
15
|
-
import type {
|
|
15
|
+
import type { RefetchEventManager } from "./RefetchEventManager.js";
|
|
16
|
+
import type { DefaultContext, ErrorLike, InternalRefetchQueriesInclude, InternalRefetchQueriesResult, MutationQueryReducersMap, MutationUpdaterFunction, NormalizedExecutionResult, OnQueryUpdated, OperationVariables, RefetchOn, RefetchQueriesInclude, RefetchQueriesPromiseResults, SubscriptionObservable, TypedDocumentNode } from "./types.js";
|
|
16
17
|
import type { ErrorPolicy, FetchPolicy, MutationFetchPolicy, NextFetchPolicyContext, RefetchWritePolicy, WatchQueryFetchPolicy } from "./watchQueryOptions.js";
|
|
17
18
|
/**
|
|
18
19
|
* @knipignore
|
|
@@ -106,6 +107,11 @@ export declare namespace ApolloClient {
|
|
|
106
107
|
* Do not pass in experiments that are not provided by Apollo.
|
|
107
108
|
*/
|
|
108
109
|
experiments?: ApolloClient.Experiment[];
|
|
110
|
+
/**
|
|
111
|
+
* The `RefetchEventManager` instance that manages automatic refetches for
|
|
112
|
+
* the client.
|
|
113
|
+
*/
|
|
114
|
+
refetchEventManager?: RefetchEventManager;
|
|
109
115
|
}
|
|
110
116
|
export interface DevtoolsOptions {
|
|
111
117
|
/**
|
|
@@ -699,6 +705,25 @@ export declare namespace ApolloClient {
|
|
|
699
705
|
*/
|
|
700
706
|
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
|
701
707
|
/**
|
|
708
|
+
* Determines whether events trigger refetches for the query. Provide an
|
|
709
|
+
* object mapping each refetch event to `true` (enable), `false` (disable)
|
|
710
|
+
* or a callback function that returns `true`/`false` to control individual
|
|
711
|
+
* events. Provide `false` to disable all automatic refetch events for this
|
|
712
|
+
* query. Provide `true` to enable all automatic refetch events for this query.
|
|
713
|
+
* Provide a callback function to perform additional logic to determine
|
|
714
|
+
* whether to enable or disable a refetch for a query.
|
|
715
|
+
*
|
|
716
|
+
* `@remarks`
|
|
717
|
+
* `refetchOn` inherits from `defaultOptions.watchQuery.refetchOn`. If
|
|
718
|
+
* `defaultOptions.watchQuery.refetchOn` is not set, all refetch events are
|
|
719
|
+
* enabled by default.
|
|
720
|
+
*
|
|
721
|
+
* This option only has an effect when the client is configured with a
|
|
722
|
+
* `refetchEventManager`.
|
|
723
|
+
* @docGroup 1. Operation options
|
|
724
|
+
*/
|
|
725
|
+
refetchOn?: RefetchOn.Option;
|
|
726
|
+
/**
|
|
702
727
|
* @internal This API is meant for framework integrations only.
|
|
703
728
|
* Do not use for everyday use.
|
|
704
729
|
*
|
|
@@ -965,6 +990,7 @@ export declare class ApolloClient {
|
|
|
965
990
|
queryDeduplication: boolean;
|
|
966
991
|
defaultOptions: ApolloClient.DefaultOptions;
|
|
967
992
|
readonly devtoolsConfig: ApolloClient.DevtoolsOptions;
|
|
993
|
+
readonly refetchEventManager: RefetchEventManager | undefined;
|
|
968
994
|
private queryManager;
|
|
969
995
|
private devToolsHookCb?;
|
|
970
996
|
private resetStoreCallbacks;
|
|
@@ -1017,6 +1043,7 @@ export declare class ApolloClient {
|
|
|
1017
1043
|
* - Unsubscribes all active `ObservableQuery` instances by emitting a `completed` event
|
|
1018
1044
|
* - Rejects all currently running queries with "QueryManager stopped while query was in flight"
|
|
1019
1045
|
* - Removes all queryRefs from the suspense cache
|
|
1046
|
+
* - Disconnects the `RefetchEventManager` if configured.
|
|
1020
1047
|
*/
|
|
1021
1048
|
stop(): void;
|
|
1022
1049
|
/**
|
package/core/ApolloClient.js
CHANGED
|
@@ -4,7 +4,7 @@ import { NotImplementedHandler } from "@apollo/client/incremental";
|
|
|
4
4
|
import { execute } from "@apollo/client/link";
|
|
5
5
|
import { DocumentTransform } from "@apollo/client/utilities";
|
|
6
6
|
import { __DEV__ } from "@apollo/client/utilities/environment";
|
|
7
|
-
import { checkDocument, compact, getApolloClientMemoryInternals, mapObservableFragmentMemoized, mergeOptions, removeMaskedFragmentSpreads, } from "@apollo/client/utilities/internal";
|
|
7
|
+
import { checkDocument, compact, getApolloClientMemoryInternals, getOperationName, mapObservableFragmentMemoized, mergeOptions, removeMaskedFragmentSpreads, } from "@apollo/client/utilities/internal";
|
|
8
8
|
import { invariant } from "@apollo/client/utilities/invariant";
|
|
9
9
|
import { version } from "../version.js";
|
|
10
10
|
import { QueryManager } from "./QueryManager.js";
|
|
@@ -39,6 +39,7 @@ export class ApolloClient {
|
|
|
39
39
|
queryDeduplication;
|
|
40
40
|
defaultOptions;
|
|
41
41
|
devtoolsConfig;
|
|
42
|
+
refetchEventManager;
|
|
42
43
|
queryManager;
|
|
43
44
|
devToolsHookCb;
|
|
44
45
|
resetStoreCallbacks = [];
|
|
@@ -73,7 +74,7 @@ export class ApolloClient {
|
|
|
73
74
|
invariant(options.cache, 68);
|
|
74
75
|
invariant(options.link, 69);
|
|
75
76
|
}
|
|
76
|
-
const { cache, documentTransform, ssrMode = false, ssrForceFetchDelay = 0, queryDeduplication = true, defaultOptions, defaultContext, assumeImmutableResults = cache.assumeImmutableResults, localState, devtools, dataMasking, link, incrementalHandler = new NotImplementedHandler(), experiments = [], } = options;
|
|
77
|
+
const { cache, documentTransform, ssrMode = false, ssrForceFetchDelay = 0, queryDeduplication = true, defaultOptions, defaultContext, assumeImmutableResults = cache.assumeImmutableResults, localState, devtools, dataMasking, link, incrementalHandler = new NotImplementedHandler(), experiments = [], refetchEventManager, } = options;
|
|
77
78
|
this.link = link;
|
|
78
79
|
this.cache = cache;
|
|
79
80
|
this.queryDeduplication = queryDeduplication;
|
|
@@ -123,6 +124,8 @@ export class ApolloClient {
|
|
|
123
124
|
if (this.devtoolsConfig.enabled)
|
|
124
125
|
this.connectToDevTools();
|
|
125
126
|
experiments.forEach((experiment) => experiment.call(this, options));
|
|
127
|
+
this.refetchEventManager = refetchEventManager;
|
|
128
|
+
this.refetchEventManager?.connect(this);
|
|
126
129
|
}
|
|
127
130
|
connectToDevTools() {
|
|
128
131
|
if (typeof window === "undefined") {
|
|
@@ -193,9 +196,11 @@ export class ApolloClient {
|
|
|
193
196
|
* - Unsubscribes all active `ObservableQuery` instances by emitting a `completed` event
|
|
194
197
|
* - Rejects all currently running queries with "QueryManager stopped while query was in flight"
|
|
195
198
|
* - Removes all queryRefs from the suspense cache
|
|
199
|
+
* - Disconnects the `RefetchEventManager` if configured.
|
|
196
200
|
*/
|
|
197
201
|
stop() {
|
|
198
202
|
this.queryManager.stop();
|
|
203
|
+
this.refetchEventManager?.disconnect(this);
|
|
199
204
|
}
|
|
200
205
|
/**
|
|
201
206
|
* This watches the cache store of the query according to the options specified and
|
|
@@ -218,7 +223,34 @@ export class ApolloClient {
|
|
|
218
223
|
*/
|
|
219
224
|
watchQuery(options) {
|
|
220
225
|
if (this.defaultOptions.watchQuery) {
|
|
226
|
+
const defaultRefetchOn = this.defaultOptions.watchQuery.refetchOn;
|
|
227
|
+
const mergedRefetchOn = (options.refetchOn &&
|
|
228
|
+
typeof options.refetchOn === "object" &&
|
|
229
|
+
defaultRefetchOn &&
|
|
230
|
+
typeof defaultRefetchOn === "object") ?
|
|
231
|
+
{ ...defaultRefetchOn, ...options.refetchOn }
|
|
232
|
+
: undefined;
|
|
221
233
|
options = mergeOptions(this.defaultOptions.watchQuery, options);
|
|
234
|
+
if (mergedRefetchOn) {
|
|
235
|
+
options.refetchOn = mergedRefetchOn;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (__DEV__) {
|
|
239
|
+
const { refetchOn, query } = options;
|
|
240
|
+
const { refetchEventManager } = this;
|
|
241
|
+
if (refetchOn) {
|
|
242
|
+
const operationName = getOperationName(query, "(anonymous)");
|
|
243
|
+
if (!refetchEventManager) {
|
|
244
|
+
__DEV__ && invariant.warn(70, operationName);
|
|
245
|
+
}
|
|
246
|
+
else if (typeof refetchOn === "object") {
|
|
247
|
+
Object.keys(refetchOn).forEach((source) => {
|
|
248
|
+
if (!refetchEventManager.hasSource(source)) {
|
|
249
|
+
__DEV__ && invariant.warn(71, source, operationName);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
222
254
|
}
|
|
223
255
|
return this.queryManager.watchQuery(options);
|
|
224
256
|
}
|
|
@@ -236,13 +268,13 @@ export class ApolloClient {
|
|
|
236
268
|
options = mergeOptions(this.defaultOptions.query, options);
|
|
237
269
|
}
|
|
238
270
|
if (__DEV__) {
|
|
239
|
-
invariant(options.fetchPolicy !== "cache-and-network",
|
|
240
|
-
invariant(options.fetchPolicy !== "standby",
|
|
241
|
-
invariant(options.query,
|
|
242
|
-
invariant(options.query.kind === "Document",
|
|
243
|
-
invariant(!options.returnPartialData,
|
|
244
|
-
invariant(!options.pollInterval,
|
|
245
|
-
invariant(!options.notifyOnNetworkStatusChange,
|
|
271
|
+
invariant(options.fetchPolicy !== "cache-and-network", 72);
|
|
272
|
+
invariant(options.fetchPolicy !== "standby", 73);
|
|
273
|
+
invariant(options.query, 74);
|
|
274
|
+
invariant(options.query.kind === "Document", 75);
|
|
275
|
+
invariant(!options.returnPartialData, 76);
|
|
276
|
+
invariant(!options.pollInterval, 77);
|
|
277
|
+
invariant(!options.notifyOnNetworkStatusChange, 78);
|
|
246
278
|
}
|
|
247
279
|
return this.queryManager.query(options);
|
|
248
280
|
};
|
|
@@ -260,9 +292,9 @@ export class ApolloClient {
|
|
|
260
292
|
errorPolicy: "none",
|
|
261
293
|
}, this.defaultOptions.mutate), options);
|
|
262
294
|
if (__DEV__) {
|
|
263
|
-
invariant(optionsWithDefaults.mutation,
|
|
295
|
+
invariant(optionsWithDefaults.mutation, 79);
|
|
264
296
|
invariant(optionsWithDefaults.fetchPolicy === "network-only" ||
|
|
265
|
-
optionsWithDefaults.fetchPolicy === "no-cache",
|
|
297
|
+
optionsWithDefaults.fetchPolicy === "no-cache", 80);
|
|
266
298
|
}
|
|
267
299
|
checkDocument(optionsWithDefaults.mutation, OperationTypeNode.MUTATION);
|
|
268
300
|
return this.queryManager.mutate(optionsWithDefaults);
|
|
@@ -468,7 +500,7 @@ export class ApolloClient {
|
|
|
468
500
|
// result.queries and result.results instead, you shouldn't have to worry
|
|
469
501
|
// about preventing uncaught rejections for the Promise.all result.
|
|
470
502
|
result.catch((error) => {
|
|
471
|
-
__DEV__ && invariant.debug(
|
|
503
|
+
__DEV__ && invariant.debug(81, error);
|
|
472
504
|
});
|
|
473
505
|
return result;
|
|
474
506
|
}
|