@apollo/client 3.8.0-alpha.2 → 3.8.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/apollo-client.cjs +16 -6
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/core.cjs +1 -1
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +1 -1
- package/invariantErrorCodes.js +1 -1
- package/package.json +12 -9
- package/react/hooks/hooks.cjs +21 -5
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +21 -5
- package/react/hooks/internal/index.d.ts +1 -0
- package/react/hooks/internal/index.d.ts.map +1 -1
- package/react/hooks/internal/index.js +1 -0
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts +3 -0
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +6 -0
- package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -0
- package/react/hooks/useQuery.d.ts +1 -0
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +8 -2
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js +5 -5
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/testing/core/core.cjs +17 -0
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +17 -0
- package/testing/core/index.d.ts +1 -0
- package/testing/core/index.d.ts.map +1 -1
- package/testing/core/index.js +1 -0
- package/testing/core/index.js.map +1 -1
- package/testing/core/wait.d.ts +3 -0
- package/testing/core/wait.d.ts.map +1 -0
- package/testing/core/wait.js +16 -0
- package/testing/core/wait.js.map +1 -0
- package/version.js +1 -1
package/apollo-client.cjs
CHANGED
|
@@ -1345,7 +1345,7 @@ var concat = ApolloLink.concat;
|
|
|
1345
1345
|
|
|
1346
1346
|
var execute = ApolloLink.execute;
|
|
1347
1347
|
|
|
1348
|
-
var version = '3.8.0-alpha.
|
|
1348
|
+
var version = '3.8.0-alpha.4';
|
|
1349
1349
|
|
|
1350
1350
|
function isNodeResponse(value) {
|
|
1351
1351
|
return !!value.body;
|
|
@@ -6833,9 +6833,10 @@ var InternalState = (function () {
|
|
|
6833
6833
|
InternalState.prototype.handleErrorOrCompleted = function (result, previousResult) {
|
|
6834
6834
|
var _this = this;
|
|
6835
6835
|
if (!result.loading) {
|
|
6836
|
+
var error_1 = this.toApolloError(result);
|
|
6836
6837
|
Promise.resolve().then(function () {
|
|
6837
|
-
if (
|
|
6838
|
-
_this.onError(
|
|
6838
|
+
if (error_1) {
|
|
6839
|
+
_this.onError(error_1);
|
|
6839
6840
|
}
|
|
6840
6841
|
else if (result.data &&
|
|
6841
6842
|
(previousResult === null || previousResult === void 0 ? void 0 : previousResult.networkStatus) !== result.networkStatus &&
|
|
@@ -6847,6 +6848,11 @@ var InternalState = (function () {
|
|
|
6847
6848
|
});
|
|
6848
6849
|
}
|
|
6849
6850
|
};
|
|
6851
|
+
InternalState.prototype.toApolloError = function (result) {
|
|
6852
|
+
return isNonEmptyArray(result.errors)
|
|
6853
|
+
? new ApolloError({ graphQLErrors: result.errors })
|
|
6854
|
+
: result.error;
|
|
6855
|
+
};
|
|
6850
6856
|
InternalState.prototype.getCurrentResult = function () {
|
|
6851
6857
|
if (!this.result) {
|
|
6852
6858
|
this.handleErrorOrCompleted(this.result = this.observable.getCurrentResult());
|
|
@@ -7216,6 +7222,10 @@ function useDeepMemo(memoFn, deps) {
|
|
|
7216
7222
|
return ref.current.value;
|
|
7217
7223
|
}
|
|
7218
7224
|
|
|
7225
|
+
var useIsomorphicLayoutEffect = canUseLayoutEffect
|
|
7226
|
+
? React.useLayoutEffect
|
|
7227
|
+
: React.useEffect;
|
|
7228
|
+
|
|
7219
7229
|
function useSuspenseCache() {
|
|
7220
7230
|
var suspenseCache = React.useContext(getApolloContext()).suspenseCache;
|
|
7221
7231
|
__DEV__ ? tsInvariant.invariant(suspenseCache, 'Could not find a "suspenseCache" in the context. Wrap the root component ' +
|
|
@@ -7248,9 +7258,9 @@ function useSuspenseQuery_experimental(query, options) {
|
|
|
7248
7258
|
var hasFullResult = result.data && !result.partial;
|
|
7249
7259
|
var hasPartialResult = result.data && result.partial;
|
|
7250
7260
|
var usePartialResult = returnPartialData && hasPartialResult;
|
|
7261
|
+
var allowsThrownErrors = errorPolicy === 'none' && (!deferred || !hasPartialResult);
|
|
7251
7262
|
if (result.error &&
|
|
7252
|
-
|
|
7253
|
-
(!deferred || !hasPartialResult)) {
|
|
7263
|
+
(result.error.networkError || allowsThrownErrors)) {
|
|
7254
7264
|
throw result.error;
|
|
7255
7265
|
}
|
|
7256
7266
|
if (result.loading) {
|
|
@@ -7361,7 +7371,7 @@ function useObservableQueryResult(observable) {
|
|
|
7361
7371
|
if (!resultRef.current) {
|
|
7362
7372
|
resultRef.current = observable.getCurrentResult();
|
|
7363
7373
|
}
|
|
7364
|
-
|
|
7374
|
+
useIsomorphicLayoutEffect(function () {
|
|
7365
7375
|
isMountedRef.current = true;
|
|
7366
7376
|
return function () {
|
|
7367
7377
|
isMountedRef.current = false;
|