Skip to content

Commit 7bfe22b

Browse files
committed
B2B-2258: Add caching capability to the storeConfig GraphQl query
1 parent 78c9d6f commit 7bfe22b

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

app/code/Magento/StoreGraphQl/Model/Resolver/Store/ConfigIdentity.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ class ConfigIdentity implements IdentityInterface
2121
*/
2222
public function getIdentities(array $resolvedData): array
2323
{
24-
$data["id"] = empty($resolvedData) ? [] : $resolvedData["id"];
25-
$ids = empty($resolvedData) ?
26-
[] : array_merge([self::CACHE_TAG], array_map(function ($key) {
27-
return sprintf('%s_%s', self::CACHE_TAG, $key);
28-
}, $data));
29-
return $ids;
24+
if (!isset($resolvedData['id'])) {
25+
return [];
26+
}
27+
return [self::CACHE_TAG, sprintf('%s_%s', self::CACHE_TAG, $resolvedData['id'])];
3028
}
3129
}

dev/tests/api-functional/testsuite/Magento/GraphQl/Store/StoreConfigCacheTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public function testCachePurgedWithStoreScopeConfigChange(): void
218218

219219
// Query default store config after second store config is changed
220220
// Verify we obtain a cache HIT at the 2nd time, the cache is not purged
221-
$defaultStoreResponseHit= $this->assertCacheHitAndReturnResponse(
221+
$defaultStoreResponseHit = $this->assertCacheHitAndReturnResponse(
222222
$query,
223223
[CacheIdCalculator::CACHE_ID_HEADER => $defaultStoreCacheId]
224224
);

dev/tests/integration/testsuite/Magento/Store/_files/multiple_websites_with_store_groups_stores_rollback.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
if ($websiteId) {
1717
$website->delete();
1818
}
19+
20+
/** Delete the third website **/
1921
$website2 = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Website::class);
2022
/** @var $website \Magento\Store\Model\Website */
2123
$websiteId2 = $website2->load('third', 'code')->getId();
@@ -30,18 +32,22 @@
3032
if ($groupId) {
3133
$group->delete();
3234
}
35+
36+
/** Delete the third store groups **/
3337
$group2 = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Group::class);
3438
/** @var $group2 \Magento\Store\Model\Group */
3539
$groupId2 = $group2->load('third_store', 'code')->getId();
3640
if ($groupId2) {
3741
$group2->delete();
3842
}
3943

44+
/** Delete the second store **/
4045
$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class);
4146
if ($store->load('second_store_view', 'code')->getId()) {
4247
$store->delete();
4348
}
4449

50+
/** Delete the third store **/
4551
$store2 = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class);
4652
if ($store2->load('third_store_view', 'code')->getId()) {
4753
$store2->delete();

0 commit comments

Comments
 (0)