@apollo/client 3.8.0-alpha.7 → 3.8.0-alpha.8
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/README.md +1 -1
- package/apollo-client.cjs +176 -167
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +20 -21
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +20 -21
- package/cache/inmemory/helpers.d.ts +2 -2
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js +2 -2
- package/cache/inmemory/helpers.js.map +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 +4 -3
- package/link/core/types.d.ts +3 -4
- package/link/core/types.d.ts.map +1 -1
- package/link/core/types.js.map +1 -1
- package/package.json +14 -14
- package/react/hooks/hooks.cjs +7 -5
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +7 -5
- package/react/hooks/useSuspenseCache.d.ts +2 -1
- package/react/hooks/useSuspenseCache.d.ts.map +1 -1
- package/react/hooks/useSuspenseCache.js +6 -4
- package/react/hooks/useSuspenseCache.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +1 -1
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/types/types.d.ts +2 -0
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/utilities/common/arrays.d.ts +1 -0
- package/utilities/common/arrays.d.ts.map +1 -1
- package/utilities/common/arrays.js +1 -0
- package/utilities/common/arrays.js.map +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +167 -90
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js +2 -2
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/utilities.cjs +170 -102
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +170 -102
- package/version.js +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ Learn how to use Apollo Client with self-paced hands-on training on Odyssey, Apo
|
|
|
37
37
|
|
|
38
38
|
- [Apollo Studio](https://www.apollographql.com/studio/develop/) – A free, end-to-end platform for managing your GraphQL lifecycle. Track your GraphQL schemas in a hosted registry to create a source of truth for everything in your graph. Studio provides an IDE (Apollo Explorer) so you can explore data, collaborate on queries, observe usage, and safely make schema changes.
|
|
39
39
|
- [Apollo Federation](https://www.apollographql.com/apollo-federation) – The industry-standard open architecture for building a distributed graph. Use Apollo’s gateway to compose a unified graph from multiple subgraphs, determine a query plan, and route requests across your services.
|
|
40
|
-
- [Apollo Client](https://www.apollographql.com/apollo-client/) – The most popular GraphQL client for the web. Apollo also builds and maintains [Apollo iOS](https://github.com/apollographql/apollo-ios) and [Apollo
|
|
40
|
+
- [Apollo Client](https://www.apollographql.com/apollo-client/) – The most popular GraphQL client for the web. Apollo also builds and maintains [Apollo iOS](https://github.com/apollographql/apollo-ios) and [Apollo Kotlin](https://github.com/apollographql/apollo-kotlin).
|
|
41
41
|
- [Apollo Server](https://www.apollographql.com/docs/apollo-server/) – A production-ready JavaScript GraphQL server that connects to any microservice, API, or database. Compatible with all popular JavaScript frameworks and deployable in serverless environments.
|
|
42
42
|
|
|
43
43
|
## Learn how to build with Apollo
|
package/apollo-client.cjs
CHANGED
|
@@ -457,26 +457,20 @@ function getDefaultValues(definition) {
|
|
|
457
457
|
return defaultValues;
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
if (test.call(this, elem, i, array)) {
|
|
464
|
-
array[target++] = elem;
|
|
465
|
-
}
|
|
466
|
-
}, context);
|
|
467
|
-
array.length = target;
|
|
468
|
-
return array;
|
|
460
|
+
var isArray = Array.isArray;
|
|
461
|
+
function isNonEmptyArray(value) {
|
|
462
|
+
return Array.isArray(value) && value.length > 0;
|
|
469
463
|
}
|
|
470
464
|
|
|
471
465
|
var TYPENAME_FIELD = {
|
|
472
|
-
kind:
|
|
466
|
+
kind: graphql.Kind.FIELD,
|
|
473
467
|
name: {
|
|
474
|
-
kind:
|
|
468
|
+
kind: graphql.Kind.NAME,
|
|
475
469
|
value: '__typename',
|
|
476
470
|
},
|
|
477
471
|
};
|
|
478
472
|
function isEmpty(op, fragmentMap) {
|
|
479
|
-
return !op || op.selectionSet.selections.every(function (selection) { return selection.kind ===
|
|
473
|
+
return !op || op.selectionSet.selections.every(function (selection) { return selection.kind === graphql.Kind.FRAGMENT_SPREAD &&
|
|
480
474
|
isEmpty(fragmentMap[selection.name.value], fragmentMap); });
|
|
481
475
|
}
|
|
482
476
|
function nullIfDocIsEmpty(doc) {
|
|
@@ -485,84 +479,190 @@ function nullIfDocIsEmpty(doc) {
|
|
|
485
479
|
: doc;
|
|
486
480
|
}
|
|
487
481
|
function getDirectiveMatcher(directives) {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
482
|
+
var nameSet = new Set();
|
|
483
|
+
var tests = [];
|
|
484
|
+
directives.forEach(function (directive) {
|
|
485
|
+
if (directive.name) {
|
|
486
|
+
nameSet.add(directive.name);
|
|
487
|
+
}
|
|
488
|
+
else if (directive.test) {
|
|
489
|
+
tests.push(directive.test);
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
return function (directive) { return (nameSet.has(directive.name.value) ||
|
|
493
|
+
tests.some(function (test) { return test(directive); })); };
|
|
494
|
+
}
|
|
495
|
+
function makeInUseGetterFunction(defaultKey) {
|
|
496
|
+
var map = new Map();
|
|
497
|
+
return function inUseGetterFunction(key) {
|
|
498
|
+
if (key === void 0) { key = defaultKey; }
|
|
499
|
+
var inUse = map.get(key);
|
|
500
|
+
if (!inUse) {
|
|
501
|
+
map.set(key, inUse = {
|
|
502
|
+
variables: new Set,
|
|
503
|
+
fragmentSpreads: new Set,
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
return inUse;
|
|
493
507
|
};
|
|
494
508
|
}
|
|
495
509
|
function removeDirectivesFromDocument(directives, doc) {
|
|
496
|
-
var
|
|
497
|
-
var
|
|
498
|
-
var
|
|
499
|
-
|
|
500
|
-
|
|
510
|
+
var getInUseByOperationName = makeInUseGetterFunction("");
|
|
511
|
+
var getInUseByFragmentName = makeInUseGetterFunction("");
|
|
512
|
+
var getInUse = function (ancestors) {
|
|
513
|
+
for (var p = 0, ancestor = void 0; p < ancestors.length && (ancestor = ancestors[p]); ++p) {
|
|
514
|
+
if (isArray(ancestor))
|
|
515
|
+
continue;
|
|
516
|
+
if (ancestor.kind === graphql.Kind.OPERATION_DEFINITION) {
|
|
517
|
+
return getInUseByOperationName(ancestor.name && ancestor.name.value);
|
|
518
|
+
}
|
|
519
|
+
if (ancestor.kind === graphql.Kind.FRAGMENT_DEFINITION) {
|
|
520
|
+
return getInUseByFragmentName(ancestor.name.value);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
__DEV__ && tsInvariant.invariant.error("Could not find operation or fragment");
|
|
524
|
+
return null;
|
|
525
|
+
};
|
|
526
|
+
var operationCount = 0;
|
|
527
|
+
for (var i = doc.definitions.length - 1; i >= 0; --i) {
|
|
528
|
+
if (doc.definitions[i].kind === graphql.Kind.OPERATION_DEFINITION) {
|
|
529
|
+
++operationCount;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
var directiveMatcher = getDirectiveMatcher(directives);
|
|
533
|
+
var hasRemoveDirective = directives.some(function (directive) { return directive.remove; });
|
|
534
|
+
var shouldRemoveField = function (nodeDirectives) { return (hasRemoveDirective &&
|
|
535
|
+
nodeDirectives &&
|
|
536
|
+
nodeDirectives.some(directiveMatcher)); };
|
|
537
|
+
var originalFragmentDefsByPath = new Map();
|
|
538
|
+
var firstVisitMadeChanges = false;
|
|
539
|
+
var fieldOrInlineFragmentVisitor = {
|
|
540
|
+
enter: function (node) {
|
|
541
|
+
if (shouldRemoveField(node.directives)) {
|
|
542
|
+
firstVisitMadeChanges = true;
|
|
543
|
+
return null;
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
};
|
|
547
|
+
var docWithoutDirectiveSubtrees = graphql.visit(doc, {
|
|
548
|
+
Field: fieldOrInlineFragmentVisitor,
|
|
549
|
+
InlineFragment: fieldOrInlineFragmentVisitor,
|
|
550
|
+
VariableDefinition: {
|
|
551
|
+
enter: function () {
|
|
552
|
+
return false;
|
|
553
|
+
},
|
|
554
|
+
},
|
|
501
555
|
Variable: {
|
|
502
|
-
enter: function (node, _key,
|
|
503
|
-
|
|
504
|
-
|
|
556
|
+
enter: function (node, _key, _parent, _path, ancestors) {
|
|
557
|
+
var inUse = getInUse(ancestors);
|
|
558
|
+
if (inUse) {
|
|
559
|
+
inUse.variables.add(node.name.value);
|
|
505
560
|
}
|
|
506
561
|
},
|
|
507
562
|
},
|
|
508
|
-
|
|
509
|
-
enter: function (node) {
|
|
510
|
-
if (
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
if (arg.value.kind === 'Variable') {
|
|
518
|
-
variablesToRemove.push({
|
|
519
|
-
name: arg.value.name.value,
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
if (node.selectionSet) {
|
|
525
|
-
getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) {
|
|
526
|
-
fragmentSpreadsToRemove.push({
|
|
527
|
-
name: frag.name.value,
|
|
528
|
-
});
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
return null;
|
|
532
|
-
}
|
|
563
|
+
FragmentSpread: {
|
|
564
|
+
enter: function (node, _key, _parent, _path, ancestors) {
|
|
565
|
+
if (shouldRemoveField(node.directives)) {
|
|
566
|
+
firstVisitMadeChanges = true;
|
|
567
|
+
return null;
|
|
568
|
+
}
|
|
569
|
+
var inUse = getInUse(ancestors);
|
|
570
|
+
if (inUse) {
|
|
571
|
+
inUse.fragmentSpreads.add(node.name.value);
|
|
533
572
|
}
|
|
534
573
|
},
|
|
535
574
|
},
|
|
536
|
-
|
|
537
|
-
enter: function (node) {
|
|
538
|
-
|
|
575
|
+
FragmentDefinition: {
|
|
576
|
+
enter: function (node, _key, _parent, path) {
|
|
577
|
+
originalFragmentDefsByPath.set(JSON.stringify(path), node);
|
|
578
|
+
},
|
|
579
|
+
leave: function (node, _key, _parent, path) {
|
|
580
|
+
var originalNode = originalFragmentDefsByPath.get(JSON.stringify(path));
|
|
581
|
+
if (node === originalNode) {
|
|
582
|
+
return node;
|
|
583
|
+
}
|
|
584
|
+
if (operationCount > 0 &&
|
|
585
|
+
node.selectionSet.selections.every(function (selection) { return (selection.kind === graphql.Kind.FIELD &&
|
|
586
|
+
selection.name.value === '__typename'); })) {
|
|
587
|
+
getInUseByFragmentName(node.name.value).removed = true;
|
|
588
|
+
firstVisitMadeChanges = true;
|
|
589
|
+
return null;
|
|
590
|
+
}
|
|
539
591
|
},
|
|
540
592
|
},
|
|
541
593
|
Directive: {
|
|
542
|
-
|
|
543
|
-
if (
|
|
594
|
+
leave: function (node) {
|
|
595
|
+
if (directiveMatcher(node)) {
|
|
596
|
+
firstVisitMadeChanges = true;
|
|
544
597
|
return null;
|
|
545
598
|
}
|
|
546
599
|
},
|
|
547
600
|
},
|
|
601
|
+
});
|
|
602
|
+
if (!firstVisitMadeChanges) {
|
|
603
|
+
return doc;
|
|
604
|
+
}
|
|
605
|
+
var populateTransitiveVars = function (inUse) {
|
|
606
|
+
if (!inUse.transitiveVars) {
|
|
607
|
+
inUse.transitiveVars = new Set(inUse.variables);
|
|
608
|
+
if (!inUse.removed) {
|
|
609
|
+
inUse.fragmentSpreads.forEach(function (childFragmentName) {
|
|
610
|
+
populateTransitiveVars(getInUseByFragmentName(childFragmentName)).transitiveVars.forEach(function (varName) {
|
|
611
|
+
inUse.transitiveVars.add(varName);
|
|
612
|
+
});
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
return inUse;
|
|
617
|
+
};
|
|
618
|
+
var allFragmentNamesUsed = new Set();
|
|
619
|
+
docWithoutDirectiveSubtrees.definitions.forEach(function (def) {
|
|
620
|
+
if (def.kind === graphql.Kind.OPERATION_DEFINITION) {
|
|
621
|
+
populateTransitiveVars(getInUseByOperationName(def.name && def.name.value)).fragmentSpreads.forEach(function (childFragmentName) {
|
|
622
|
+
allFragmentNamesUsed.add(childFragmentName);
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
else if (def.kind === graphql.Kind.FRAGMENT_DEFINITION &&
|
|
626
|
+
operationCount === 0 &&
|
|
627
|
+
!getInUseByFragmentName(def.name.value).removed) {
|
|
628
|
+
allFragmentNamesUsed.add(def.name.value);
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
allFragmentNamesUsed.forEach(function (fragmentName) {
|
|
632
|
+
populateTransitiveVars(getInUseByFragmentName(fragmentName)).fragmentSpreads.forEach(function (childFragmentName) {
|
|
633
|
+
allFragmentNamesUsed.add(childFragmentName);
|
|
634
|
+
});
|
|
635
|
+
});
|
|
636
|
+
var fragmentWillBeRemoved = function (fragmentName) { return !!(!allFragmentNamesUsed.has(fragmentName) ||
|
|
637
|
+
getInUseByFragmentName(fragmentName).removed); };
|
|
638
|
+
var enterVisitor = {
|
|
639
|
+
enter: function (node) {
|
|
640
|
+
if (fragmentWillBeRemoved(node.name.value)) {
|
|
641
|
+
return null;
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
};
|
|
645
|
+
return nullIfDocIsEmpty(graphql.visit(docWithoutDirectiveSubtrees, {
|
|
646
|
+
FragmentSpread: enterVisitor,
|
|
647
|
+
FragmentDefinition: enterVisitor,
|
|
648
|
+
OperationDefinition: {
|
|
649
|
+
leave: function (node) {
|
|
650
|
+
if (node.variableDefinitions) {
|
|
651
|
+
var usedVariableNames_1 = populateTransitiveVars(getInUseByOperationName(node.name && node.name.value)).transitiveVars;
|
|
652
|
+
if (usedVariableNames_1.size < node.variableDefinitions.length) {
|
|
653
|
+
return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { return usedVariableNames_1.has(varDef.variable.name.value); }) });
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
},
|
|
657
|
+
},
|
|
548
658
|
}));
|
|
549
|
-
if (modifiedDoc &&
|
|
550
|
-
filterInPlace(variablesToRemove, function (v) { return !!v.name && !variablesInUse[v.name]; }).length) {
|
|
551
|
-
modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);
|
|
552
|
-
}
|
|
553
|
-
if (modifiedDoc &&
|
|
554
|
-
filterInPlace(fragmentSpreadsToRemove, function (fs) { return !!fs.name && !fragmentSpreadsInUse[fs.name]; })
|
|
555
|
-
.length) {
|
|
556
|
-
modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc);
|
|
557
|
-
}
|
|
558
|
-
return modifiedDoc;
|
|
559
659
|
}
|
|
560
660
|
var addTypenameToDocument = Object.assign(function (doc) {
|
|
561
661
|
return graphql.visit(doc, {
|
|
562
662
|
SelectionSet: {
|
|
563
663
|
enter: function (node, _key, parent) {
|
|
564
664
|
if (parent &&
|
|
565
|
-
parent.kind ===
|
|
665
|
+
parent.kind === graphql.Kind.OPERATION_DEFINITION) {
|
|
566
666
|
return;
|
|
567
667
|
}
|
|
568
668
|
var selections = node.selections;
|
|
@@ -608,78 +708,6 @@ var connectionRemoveConfig = {
|
|
|
608
708
|
function removeConnectionDirectiveFromDocument(doc) {
|
|
609
709
|
return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc));
|
|
610
710
|
}
|
|
611
|
-
function getArgumentMatcher(config) {
|
|
612
|
-
return function argumentMatcher(argument) {
|
|
613
|
-
return config.some(function (aConfig) {
|
|
614
|
-
return argument.value &&
|
|
615
|
-
argument.value.kind === 'Variable' &&
|
|
616
|
-
argument.value.name &&
|
|
617
|
-
(aConfig.name === argument.value.name.value ||
|
|
618
|
-
(aConfig.test && aConfig.test(argument)));
|
|
619
|
-
});
|
|
620
|
-
};
|
|
621
|
-
}
|
|
622
|
-
function removeArgumentsFromDocument(config, doc) {
|
|
623
|
-
var argMatcher = getArgumentMatcher(config);
|
|
624
|
-
return nullIfDocIsEmpty(graphql.visit(doc, {
|
|
625
|
-
OperationDefinition: {
|
|
626
|
-
enter: function (node) {
|
|
627
|
-
return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions ? node.variableDefinitions.filter(function (varDef) {
|
|
628
|
-
return !config.some(function (arg) { return arg.name === varDef.variable.name.value; });
|
|
629
|
-
}) : [] });
|
|
630
|
-
},
|
|
631
|
-
},
|
|
632
|
-
Field: {
|
|
633
|
-
enter: function (node) {
|
|
634
|
-
var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; });
|
|
635
|
-
if (shouldRemoveField) {
|
|
636
|
-
var argMatchCount_1 = 0;
|
|
637
|
-
if (node.arguments) {
|
|
638
|
-
node.arguments.forEach(function (arg) {
|
|
639
|
-
if (argMatcher(arg)) {
|
|
640
|
-
argMatchCount_1 += 1;
|
|
641
|
-
}
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
if (argMatchCount_1 === 1) {
|
|
645
|
-
return null;
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
},
|
|
649
|
-
},
|
|
650
|
-
Argument: {
|
|
651
|
-
enter: function (node) {
|
|
652
|
-
if (argMatcher(node)) {
|
|
653
|
-
return null;
|
|
654
|
-
}
|
|
655
|
-
},
|
|
656
|
-
},
|
|
657
|
-
}));
|
|
658
|
-
}
|
|
659
|
-
function removeFragmentSpreadFromDocument(config, doc) {
|
|
660
|
-
function enter(node) {
|
|
661
|
-
if (config.some(function (def) { return def.name === node.name.value; })) {
|
|
662
|
-
return null;
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
return nullIfDocIsEmpty(graphql.visit(doc, {
|
|
666
|
-
FragmentSpread: { enter: enter },
|
|
667
|
-
FragmentDefinition: { enter: enter },
|
|
668
|
-
}));
|
|
669
|
-
}
|
|
670
|
-
function getAllFragmentSpreadsFromSelectionSet(selectionSet) {
|
|
671
|
-
var allFragments = [];
|
|
672
|
-
selectionSet.selections.forEach(function (selection) {
|
|
673
|
-
if ((isField(selection) || isInlineFragment(selection)) &&
|
|
674
|
-
selection.selectionSet) {
|
|
675
|
-
getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); });
|
|
676
|
-
}
|
|
677
|
-
else if (selection.kind === 'FragmentSpread') {
|
|
678
|
-
allFragments.push(selection);
|
|
679
|
-
}
|
|
680
|
-
});
|
|
681
|
-
return allFragments;
|
|
682
|
-
}
|
|
683
711
|
function buildQueryFromSelectionSet(document) {
|
|
684
712
|
var definition = getMainDefinition(document);
|
|
685
713
|
var definitionOperation = definition.operation;
|
|
@@ -703,22 +731,6 @@ function removeClientSetsFromDocument(document) {
|
|
|
703
731
|
remove: true,
|
|
704
732
|
},
|
|
705
733
|
], document);
|
|
706
|
-
if (modifiedDoc) {
|
|
707
|
-
modifiedDoc = graphql.visit(modifiedDoc, {
|
|
708
|
-
FragmentDefinition: {
|
|
709
|
-
enter: function (node) {
|
|
710
|
-
if (node.selectionSet) {
|
|
711
|
-
var isTypenameOnly = node.selectionSet.selections.every(function (selection) {
|
|
712
|
-
return isField(selection) && selection.name.value === '__typename';
|
|
713
|
-
});
|
|
714
|
-
if (isTypenameOnly) {
|
|
715
|
-
return null;
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
},
|
|
719
|
-
},
|
|
720
|
-
});
|
|
721
|
-
}
|
|
722
734
|
return modifiedDoc;
|
|
723
735
|
}
|
|
724
736
|
|
|
@@ -971,9 +983,9 @@ var Concast = (function (_super) {
|
|
|
971
983
|
}
|
|
972
984
|
},
|
|
973
985
|
complete: function () {
|
|
974
|
-
var sub =
|
|
986
|
+
var _a = _this, sub = _a.sub, _b = _a.sources, sources = _b === void 0 ? [] : _b;
|
|
975
987
|
if (sub !== null) {
|
|
976
|
-
var value =
|
|
988
|
+
var value = sources.shift();
|
|
977
989
|
if (!value) {
|
|
978
990
|
if (sub)
|
|
979
991
|
setTimeout(function () { return sub.unsubscribe(); });
|
|
@@ -1067,10 +1079,6 @@ var Concast = (function (_super) {
|
|
|
1067
1079
|
}(zenObservableTs.Observable));
|
|
1068
1080
|
fixObservableSubclass(Concast);
|
|
1069
1081
|
|
|
1070
|
-
function isNonEmptyArray(value) {
|
|
1071
|
-
return Array.isArray(value) && value.length > 0;
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
1082
|
function isExecutionPatchIncrementalResult(value) {
|
|
1075
1083
|
return "incremental" in value;
|
|
1076
1084
|
}
|
|
@@ -1383,7 +1391,7 @@ var concat = ApolloLink.concat;
|
|
|
1383
1391
|
|
|
1384
1392
|
var execute = ApolloLink.execute;
|
|
1385
1393
|
|
|
1386
|
-
var version = '3.8.0-alpha.
|
|
1394
|
+
var version = '3.8.0-alpha.8';
|
|
1387
1395
|
|
|
1388
1396
|
function asyncIterator(source) {
|
|
1389
1397
|
var _a;
|
|
@@ -2066,7 +2074,6 @@ var hasOwn = Object.prototype.hasOwnProperty;
|
|
|
2066
2074
|
function isNullish(value) {
|
|
2067
2075
|
return value === null || value === void 0;
|
|
2068
2076
|
}
|
|
2069
|
-
var isArray = Array.isArray;
|
|
2070
2077
|
function defaultDataIdFromObject(_a, context) {
|
|
2071
2078
|
var __typename = _a.__typename, id = _a.id, _id = _a._id;
|
|
2072
2079
|
if (typeof __typename === "string") {
|
|
@@ -7328,10 +7335,12 @@ var useIsomorphicLayoutEffect = canUseLayoutEffect
|
|
|
7328
7335
|
? React.useLayoutEffect
|
|
7329
7336
|
: React.useEffect;
|
|
7330
7337
|
|
|
7331
|
-
function useSuspenseCache() {
|
|
7332
|
-
var
|
|
7333
|
-
|
|
7334
|
-
|
|
7338
|
+
function useSuspenseCache(override) {
|
|
7339
|
+
var context = React.useContext(getApolloContext());
|
|
7340
|
+
var suspenseCache = override || context.suspenseCache;
|
|
7341
|
+
__DEV__ ? tsInvariant.invariant(suspenseCache, 'Could not find a "suspenseCache" in the context or passed in as an option. ' +
|
|
7342
|
+
'Wrap the root component in an <ApolloProvider> and provide a suspenseCache, ' +
|
|
7343
|
+
'or pass a SuspenseCache instance in via options.') : tsInvariant.invariant(suspenseCache, 33);
|
|
7335
7344
|
return suspenseCache;
|
|
7336
7345
|
}
|
|
7337
7346
|
|
|
@@ -7346,7 +7355,7 @@ var DEFAULT_SUSPENSE_POLICY = 'always';
|
|
|
7346
7355
|
var DEFAULT_ERROR_POLICY = 'none';
|
|
7347
7356
|
function useSuspenseQuery_experimental(query, options) {
|
|
7348
7357
|
if (options === void 0) { options = Object.create(null); }
|
|
7349
|
-
var suspenseCache = useSuspenseCache();
|
|
7358
|
+
var suspenseCache = useSuspenseCache(options.suspenseCache);
|
|
7350
7359
|
var client = useApolloClient(options.client);
|
|
7351
7360
|
var watchQueryOptions = useWatchQueryOptions({ query: query, options: options, client: client });
|
|
7352
7361
|
var previousWatchQueryOptionsRef = React.useRef(watchQueryOptions);
|