@apollo/client
Advanced tools
Comparing version 3.0.0-alpha.8 to 3.0.0-alpha.9
@@ -37,2 +37,3 @@ import { InlineFragmentNode, FragmentDefinitionNode, SelectionSetNode, FieldNode } from "graphql"; | ||
variables?: Record<string, any>; | ||
toReference: Policies["toReference"]; | ||
} | ||
@@ -61,2 +62,3 @@ interface FieldReadFunction<TExisting, TResult = TExisting> { | ||
}); | ||
toReference: (object: StoreObject, selectionSet?: SelectionSetNode, fragmentMap?: FragmentMap) => import("../../utilities/graphql/storeUtils").Reference; | ||
identify(object: StoreObject, selectionSet?: SelectionSetNode, fragmentMap?: FragmentMap): string | null; | ||
@@ -63,0 +65,0 @@ addTypePolicies(typePolicies: TypePolicies): void; |
import { __assign } from 'tslib'; | ||
import invariant from 'ts-invariant'; | ||
import { getFragmentFromSelection } from '../../utilities/graphql/fragments.js'; | ||
import { getTypenameFromResult, valueToObjectRepresentation, storeKeyNameFromField, argumentsObjectFromField, isField } from '../../utilities/graphql/storeUtils.js'; | ||
import { makeReference, getTypenameFromResult, valueToObjectRepresentation, storeKeyNameFromField, argumentsObjectFromField, isField } from '../../utilities/graphql/storeUtils.js'; | ||
import { canUseWeakMap } from '../../utilities/common/canUse.js'; | ||
@@ -22,2 +22,3 @@ import { KeyTrie } from 'optimism'; | ||
function Policies(config) { | ||
var _this = this; | ||
if (config === void 0) { config = {}; } | ||
@@ -33,2 +34,6 @@ this.config = config; | ||
this.usingPossibleTypes = false; | ||
this.toReference = function (object, selectionSet, fragmentMap) { | ||
var id = _this.identify(object, selectionSet, fragmentMap); | ||
return id && makeReference(id); | ||
}; | ||
this.config = __assign({ dataIdFromObject: defaultDataIdFromObject }, config); | ||
@@ -184,2 +189,3 @@ if (config.possibleTypes) { | ||
variables: variables, | ||
toReference: this.toReference, | ||
}); | ||
@@ -198,2 +204,3 @@ } | ||
variables: variables, | ||
toReference: _this.toReference, | ||
}); }; | ||
@@ -200,0 +207,0 @@ } |
{ | ||
"name": "@apollo/client", | ||
"version": "3.0.0-alpha.8", | ||
"version": "3.0.0-alpha.9", | ||
"description": "A fully-featured caching GraphQL client.", | ||
@@ -31,6 +31,9 @@ "private": false, | ||
"peerDependencies": { | ||
"graphql": "^14.5.4" | ||
"graphql": "^14.5.4", | ||
"react": "^16.8.0" | ||
}, | ||
"optionalDependencies": { | ||
"react": "^16.10.2" | ||
"peerDependenciesMeta": { | ||
"react": { | ||
"optional": true | ||
} | ||
}, | ||
@@ -64,3 +67,4 @@ "dependencies": { | ||
"prop-types": "15.7.2", | ||
"react-dom": "^16.10.2", | ||
"react": "^16.11.0", | ||
"react-dom": "^16.11.0", | ||
"rimraf": "^3.0.0", | ||
@@ -67,0 +71,0 @@ "rollup": "1.21.2", |
@@ -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, 6) : invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' + | ||
process.env.NODE_ENV === "production" ? invariant(context && context.client, 7) : 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, 7) : invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' + | ||
process.env.NODE_ENV === "production" ? invariant(context.client, 6) : 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)); |
@@ -32,10 +32,8 @@ import { __assign } from 'tslib'; | ||
: result; | ||
useEffect(function () { return queryData.afterExecute({ lazy: lazy }); }, lazy | ||
? undefined | ||
: [ | ||
queryResult.loading, | ||
queryResult.networkStatus, | ||
queryResult.error, | ||
queryResult.data | ||
]); | ||
useEffect(function () { return queryData.afterExecute({ lazy: lazy }); }, [ | ||
queryResult.loading, | ||
queryResult.networkStatus, | ||
queryResult.error, | ||
queryResult.data | ||
]); | ||
useEffect(function () { | ||
@@ -42,0 +40,0 @@ return function () { return queryData.cleanup(); }; |
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 not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1889479
18143
27