Skip to content

Commit d7ca599

Browse files
authored
Fix IgnoreForWireExtender ignore non Livewire requests (#38)
1 parent 07c5b20 commit d7ca599

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

src/Http/Middlewares/IgnoreForWireExtender.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@ trait IgnoreForWireExtender
2020
public function handle($request, Closure $next)
2121
{
2222
// We only care about requests from an embedded component
23-
if ($this->isLivewireUpdateRequest($request)) {
24-
// Loop through all components that are part of the update
25-
foreach ($request->json('components', []) as $component) {
26-
$snapshot = json_decode($component['snapshot'], true);
27-
$component = $snapshot['memo']['name'] ?? false;
23+
if (! $this->isLivewireUpdateRequest($request)) {
24+
return parent::handle($request, $next);
25+
}
26+
27+
// Loop through all components that are part of the update
28+
foreach ($request->json('components', []) as $component) {
29+
$snapshot = json_decode($component['snapshot'], true);
30+
$component = $snapshot['memo']['name'] ?? false;
2831

29-
// All components must be embeddable otherwise we will apply the existing middleware
30-
if (WireExtender::isEmbeddable($component) === false) {
31-
return parent::handle($request, $next);
32-
}
32+
// All components must be embeddable otherwise we will apply the existing middleware
33+
if (WireExtender::isEmbeddable($component) === false) {
34+
return parent::handle($request, $next);
3335
}
3436
}
3537

0 commit comments

Comments
 (0)