Skip to content

Commit bf0030f

Browse files
committed
Update blocks
1 parent fcf9eed commit bf0030f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/code/Magento/CmsGraphQl/Model/Resolver/Blocks.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ private function getBlocksData(array $blockIdentifiers): array
7878
$blocksData = [];
7979
try {
8080
foreach ($blockIdentifiers as $blockIdentifier) {
81-
$blocksData[$blockIdentifier] = $this->blockDataProvider->getData($blockIdentifier);
81+
$blockData = $this->blockDataProvider->getData($blockIdentifier);
82+
if (!empty($blockData)) {
83+
$blocksData[$blockIdentifier] = $blockData;
84+
}
8285
}
8386
} catch (NoSuchEntityException $e) {
8487
throw new GraphQlNoSuchEntityException(__($e->getMessage()), $e);

app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Block.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getData(string $blockIdentifier): array
4949
$block = $this->blockRepository->getById($blockIdentifier);
5050

5151
if (false === $block->isActive()) {
52-
throw new NoSuchEntityException();
52+
return [];
5353
}
5454

5555
$renderedContent = $this->widgetFilter->filter($block->getContent());

0 commit comments

Comments
 (0)