Skip to content

Commit d35759e

Browse files
committed
MC-41819: Pagination breaks when the shared catalogue is enabled
- Fix cache not invalidated after mview update
1 parent 402f81b commit d35759e

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

app/code/Magento/Indexer/Model/Indexer/DeferredCacheContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(CacheContext $cacheContext)
5151
public function registerEntities(string $cacheTag, array $ids): void
5252
{
5353
if ($this->isActive()) {
54-
$this->entities[$cacheTag] = array_merge($this->tags[$cacheTag] ?? [], $ids);
54+
$this->entities[$cacheTag] = array_merge($this->entities[$cacheTag] ?? [], $ids);
5555
}
5656
}
5757

app/code/Magento/Indexer/Test/Unit/Model/Indexer/DeferredCacheContextTest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,24 @@ public function test(): void
4242
{
4343
$productTag = 'cat_p';
4444
$categoryTag = 'cat_c';
45-
$additionalTags = ['cat_c_p'];
46-
$productIds = [1, 2, 3];
45+
$additionalTags1 = ['cat_c_p'];
46+
$additionalTags2 = ['cms_page'];
47+
$productIds1 = [1, 2, 3];
48+
$productIds2 = [4];
4749
$categoryIds = [5, 6, 7];
4850
$this->model->start();
49-
$this->model->registerEntities($productTag, $productIds);
51+
$this->model->registerEntities($productTag, $productIds1);
52+
$this->model->registerTags($additionalTags1);
5053
$this->model->start();
54+
$this->model->registerEntities($productTag, $productIds2);
5155
$this->model->registerEntities($categoryTag, $categoryIds);
52-
$this->model->registerTags($additionalTags);
56+
$this->model->registerTags($additionalTags2);
5357
$this->assertEmpty($this->context->getIdentities());
5458
$this->model->commit();
5559
$this->assertEmpty($this->context->getIdentities());
5660
$this->model->commit();
5761
$this->assertEquals(
58-
['cat_p_1', 'cat_p_2', 'cat_p_3', 'cat_c_5', 'cat_c_6', 'cat_c_7', 'cat_c_p'],
62+
['cat_p_1', 'cat_p_2', 'cat_p_3', 'cat_p_4', 'cat_c_5', 'cat_c_6', 'cat_c_7', 'cat_c_p', 'cms_page'],
5963
$this->context->getIdentities()
6064
);
6165
}

0 commit comments

Comments
 (0)