diff --git a/vendor/magento/module-graph-ql-cache/Model/Plugin/View/Layout.php b/vendor/magento/module-graph-ql-cache/Model/Plugin/View/Layout.php new file mode 100644 index 000000000000..fbe40559419c --- /dev/null +++ b/vendor/magento/module-graph-ql-cache/Model/Plugin/View/Layout.php @@ -0,0 +1,63 @@ +cacheableQuery = $cacheableQuery; + } + + /** + * Add block cache tags to cacheable query + * + * @param LayoutInterface $subject + * @param mixed $result + * @param mixed $name + * @param mixed $block + * @return mixed + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterSetBlock( + LayoutInterface $subject, + mixed $result, + mixed $name, + mixed $block + ): mixed { + if ($block instanceof IdentityInterface) { + $this->cacheableQuery->addCacheTags($block->getIdentities()); + } + return $result; + } +} diff --git a/vendor/magento/module-graph-ql-cache/etc/graphql/di.xml b/vendor/magento/module-graph-ql-cache/etc/graphql/di.xml index 5dd8c816ce92..eb2e62621c03 100644 --- a/vendor/magento/module-graph-ql-cache/etc/graphql/di.xml +++ b/vendor/magento/module-graph-ql-cache/etc/graphql/di.xml @@ -23,4 +23,7 @@ + + +