Skip to content

Commit d0345a6

Browse files
committed
Remove requirement for loading layout before component updates
1 parent 47e8221 commit d0345a6

2 files changed

Lines changed: 3 additions & 12 deletions

File tree

Controller/Index/Html.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function execute(): ResultInterface|ResponseInterface
5858

5959
foreach ($updates as $update) {
6060
try {
61-
$debugMessage = 'Component update: '.$update->getBlock()->getNameInLayout();
61+
$debugMessage = 'Component update: '.$update->getComponent()->getName();
6262
$this->logger->debug($debugMessage);
6363

6464
$this->repositoryDispatcher->dispatch(
@@ -102,14 +102,12 @@ public function execute(): ResultInterface|ResponseInterface
102102
*
103103
* @return ComponentUpdate[]
104104
*/
105-
private function getComponentUpdates(array $updates, LayoutInterface $layout): array
105+
private function getComponentUpdates(array $updates): array
106106
{
107107
$componentUpdates = [];
108108
foreach ($updates as $updateIndex => $update) {
109-
$block = $this->getBlock($layout, $update['blockName']);
110109
$componentUpdate = $this->componentUpdateFactory->create([
111-
'block' => $block,
112-
'component' => $this->componentRegistry->getComponentFromBlock($block),
110+
'component' => $this->componentRegistry->getComponentByName($update['blockName']),
113111
'componentData' => $update['update'],
114112
]);
115113

Util/Controller/ComponentUpdate.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,15 @@
33
namespace Loki\Components\Util\Controller;
44

55
use Loki\Components\Component\Component;
6-
use Magento\Framework\View\Element\AbstractBlock;
76

87
class ComponentUpdate
98
{
109
public function __construct(
11-
private readonly AbstractBlock $block,
1210
private readonly Component $component,
1311
private readonly mixed $componentData = null
1412
) {
1513
}
1614

17-
public function getBlock(): AbstractBlock
18-
{
19-
return $this->block;
20-
}
21-
2215
public function getComponent(): Component
2316
{
2417
return $this->component;

0 commit comments

Comments
 (0)