@apollo/client
Advanced tools
Comparing version 3.0.0-rc.1 to 3.0.0-rc.2
@@ -25,3 +25,3 @@ import { __assign } from 'tslib'; | ||
if (!cache) { | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(3) : new InvariantError("To initialize Apollo Client, you must specify a 'cache' property " + | ||
throw process.env.NODE_ENV === "production" ? new InvariantError(1) : new InvariantError("To initialize Apollo Client, you must specify a 'cache' property " + | ||
"in the options object. \n" + | ||
@@ -118,3 +118,3 @@ "For more information, please visit: https://go.apollo.dev/c/docs"); | ||
} | ||
process.env.NODE_ENV === "production" ? invariant(options.fetchPolicy !== 'cache-and-network', 4) : invariant(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' + | ||
process.env.NODE_ENV === "production" ? invariant(options.fetchPolicy !== 'cache-and-network', 2) : invariant(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' + | ||
'client.query can only return a single result. Please use client.watchQuery ' + | ||
@@ -121,0 +121,0 @@ 'to receive multiple results from the cache and the network, or consider ' + |
@@ -182,3 +182,3 @@ import { __awaiter, __generator, __assign } from 'tslib'; | ||
fragment = fragmentMap[selection.name.value]; | ||
process.env.NODE_ENV === "production" ? invariant(fragment, 22) : invariant(fragment, "No fragment named " + selection.name.value); | ||
process.env.NODE_ENV === "production" ? invariant(fragment, 14) : invariant(fragment, "No fragment named " + selection.name.value); | ||
} | ||
@@ -185,0 +185,0 @@ if (fragment && fragment.typeCondition) { |
@@ -49,3 +49,3 @@ import { __awaiter, __generator, __assign } from 'tslib'; | ||
}); | ||
this.cancelPendingFetches(process.env.NODE_ENV === "production" ? new InvariantError(14) : new InvariantError('QueryManager stopped while query was in flight')); | ||
this.cancelPendingFetches(process.env.NODE_ENV === "production" ? new InvariantError(15) : new InvariantError('QueryManager stopped while query was in flight')); | ||
}; | ||
@@ -64,4 +64,4 @@ QueryManager.prototype.cancelPendingFetches = function (error) { | ||
case 0: | ||
process.env.NODE_ENV === "production" ? invariant(mutation, 15) : invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.'); | ||
process.env.NODE_ENV === "production" ? invariant(!fetchPolicy || fetchPolicy === 'no-cache', 16) : invariant(!fetchPolicy || fetchPolicy === 'no-cache', "Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior."); | ||
process.env.NODE_ENV === "production" ? invariant(mutation, 16) : invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.'); | ||
process.env.NODE_ENV === "production" ? invariant(!fetchPolicy || fetchPolicy === 'no-cache', 17) : invariant(!fetchPolicy || fetchPolicy === 'no-cache', "Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior."); | ||
mutationId = this.generateMutationId(); | ||
@@ -276,7 +276,7 @@ mutation = this.transform(mutation).document; | ||
var _this = this; | ||
process.env.NODE_ENV === "production" ? invariant(options.query, 17) : invariant(options.query, 'query option is required. You must specify your GraphQL document ' + | ||
process.env.NODE_ENV === "production" ? invariant(options.query, 18) : invariant(options.query, 'query option is required. You must specify your GraphQL document ' + | ||
'in the query option.'); | ||
process.env.NODE_ENV === "production" ? invariant(options.query.kind === 'Document', 18) : invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.'); | ||
process.env.NODE_ENV === "production" ? invariant(!options.returnPartialData, 19) : invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.'); | ||
process.env.NODE_ENV === "production" ? invariant(!options.pollInterval, 20) : invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.'); | ||
process.env.NODE_ENV === "production" ? invariant(options.query.kind === 'Document', 19) : invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.'); | ||
process.env.NODE_ENV === "production" ? invariant(!options.returnPartialData, 20) : invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.'); | ||
process.env.NODE_ENV === "production" ? invariant(!options.pollInterval, 21) : invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.'); | ||
var queryId = this.generateQueryId(); | ||
@@ -307,3 +307,3 @@ return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); }); | ||
QueryManager.prototype.clearStore = function () { | ||
this.cancelPendingFetches(process.env.NODE_ENV === "production" ? new InvariantError(21) : new InvariantError('Store reset while query was in flight (not completed in link chain)')); | ||
this.cancelPendingFetches(process.env.NODE_ENV === "production" ? new InvariantError(22) : new InvariantError('Store reset while query was in flight (not completed in link chain)')); | ||
this.queries.forEach(function (queryInfo) { | ||
@@ -310,0 +310,0 @@ if (queryInfo.observableQuery) { |
{ | ||
"name": "@apollo/client", | ||
"version": "3.0.0-rc.1", | ||
"version": "3.0.0-rc.2", | ||
"description": "A fully-featured caching GraphQL client.", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -8,3 +8,3 @@ import { invariant } from 'ts-invariant'; | ||
return React.createElement(ApolloContext.Consumer, null, function (context) { | ||
process.env.NODE_ENV === "production" ? invariant(context && context.client, 5) : invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' + | ||
process.env.NODE_ENV === "production" ? invariant(context && context.client, 4) : invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' + | ||
'Wrap the root component in an <ApolloProvider>.'); | ||
@@ -11,0 +11,0 @@ return props.children(context.client); |
@@ -13,3 +13,3 @@ import { invariant } from 'ts-invariant'; | ||
} | ||
process.env.NODE_ENV === "production" ? invariant(context.client, 1) : invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' + | ||
process.env.NODE_ENV === "production" ? invariant(context.client, 5) : invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' + | ||
'sure you pass in your client via the "client" prop.'); | ||
@@ -16,0 +16,0 @@ return (React.createElement(ApolloContext.Provider, { value: context }, children)); |
@@ -19,5 +19,3 @@ import { __extends, __assign } from 'tslib'; | ||
_this.lazyOptions = options; | ||
if (_this.isMounted || _this.ssrInitiated()) { | ||
_this.onNewData(); | ||
} | ||
_this.onNewData(); | ||
}; | ||
@@ -229,5 +227,3 @@ _this.getQueryResult = function () { | ||
} | ||
if (_this.isMounted || _this.ssrInitiated()) { | ||
onNewData(); | ||
} | ||
onNewData(); | ||
}, | ||
@@ -242,5 +238,3 @@ error: function (error) { | ||
_this.previousData.error = error; | ||
if (_this.isMounted || _this.ssrInitiated()) { | ||
onNewData(); | ||
} | ||
onNewData(); | ||
} | ||
@@ -247,0 +241,0 @@ } |
@@ -7,3 +7,3 @@ import { invariant } from 'ts-invariant'; | ||
var client = React.useContext(getApolloContext()).client; | ||
process.env.NODE_ENV === "production" ? invariant(client, 2) : invariant(client, 'No Apollo Client instance can be found. Please ensure that you ' + | ||
process.env.NODE_ENV === "production" ? invariant(client, 3) : invariant(client, 'No Apollo Client instance can be found. Please ensure that you ' + | ||
'have called `ApolloProvider` higher up in your tree.'); | ||
@@ -10,0 +10,0 @@ return client; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
2113537
19904