Skip to content

Commit cce42c3

Browse files
committed
fix(laravel): skip updating blocks marked for removal and reindex filtered regions
1 parent aeefba0 commit cce42c3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/laravel/src/Support/HandleUpdates.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ private function applyUpdates(array $data, UpdateRequest $updateRequest, ?array
7878

7979
// Update blocks
8080
foreach ($updateRequest->getBlocks() as $blockId => $blockData) {
81+
if (in_array($blockId, $blocksToRemove)) {
82+
continue;
83+
}
84+
8185
$shouldUpdate = ! $filteredChanges ||
8286
in_array($blockId, $regionBlocks) ||
8387
in_array($blockId, $filteredChanges['added']);
@@ -90,7 +94,7 @@ private function applyUpdates(array $data, UpdateRequest $updateRequest, ?array
9094
// Update regions
9195
if (! empty($updateRequest->regions)) {
9296
$data['regions'] = $targetRegions
93-
? array_filter($updateRequest->regions, fn ($region) => in_array($region['name'], $targetRegions))
97+
? array_values(array_filter($updateRequest->regions, fn ($region) => in_array($region['name'], $targetRegions)))
9498
: $updateRequest->regions;
9599
}
96100

0 commit comments

Comments
 (0)