Skip to content

Commit ccf3489

Browse files
committed
B2B-2658: Implement GraphQL Resolver Cache for Customer query
- added array checks for values before processing
1 parent f600b16 commit ccf3489

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/code/Magento/GraphQlResolverCache/Model/Plugin/Resolver/Cache.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ private function executeResolver(
166166
array &$value = null,
167167
array $args = null
168168
) {
169-
$this->valueProcessor->preProcessParentValue($value);
169+
if (is_array($value)) {
170+
$this->valueProcessor->preProcessParentValue($value);
171+
}
170172
return $closure($field, $context, $info, $value, $args);
171173
}
172174

app/code/Magento/GraphQlResolverCache/Model/Resolver/Result/CacheKey/Calculator.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ public function calculateCacheKey(?array $parentResolverData = null): ?string
8888
foreach ($this->factorProviderInstances as $provider) {
8989
if ($provider instanceof ParentValueFactorProviderInterface) {
9090
// trigger data hydration for key calculation
91-
// only when the parent-dependent key factor provider is called
92-
$this->valueProcessor->preProcessParentValue($parentResolverData);
91+
// only when the parent-dependent key factor provider is called and the value is an array
92+
if (is_array($parentResolverData)) {
93+
$this->valueProcessor->preProcessParentValue($parentResolverData);
94+
}
9395
$keys[$provider->getFactorName()] = $provider->getFactorValue(
9496
$context,
9597
$parentResolverData

0 commit comments

Comments
 (0)