diff --git a/src/ContextProviders/LaravelLivewireRequestContextProvider.php b/src/ContextProviders/LaravelLivewireRequestContextProvider.php index 49054013..e421e118 100644 --- a/src/ContextProviders/LaravelLivewireRequestContextProvider.php +++ b/src/ContextProviders/LaravelLivewireRequestContextProvider.php @@ -6,7 +6,6 @@ use Illuminate\Http\Request; use Illuminate\Support\Arr; use Livewire\LivewireManager; -use Livewire\Mechanisms\ComponentRegistry; class LaravelLivewireRequestContextProvider extends LaravelRequestContextProvider { @@ -41,26 +40,6 @@ public function toArray(): array /** @return array */ protected function getLivewireInformation(): array { - if ($this->request->has('components')) { - $data = []; - - foreach ($this->request->get('components') as $component) { - $snapshot = json_decode($component['snapshot'], true); - - $class = app(ComponentRegistry::class)->getClass($snapshot['memo']['name']); - - $data[] = [ - 'component_class' => $class ?? null, - 'data' => $snapshot['data'], - 'memo' => $snapshot['memo'], - 'updates' => $this->resolveUpdates($component['updates']), - 'calls' => $component['calls'], - ]; - } - - return $data; - } - /** @phpstan-ignore-next-line */ $componentId = $this->request->input('fingerprint.id'); @@ -77,17 +56,12 @@ protected function getLivewireInformation(): array $componentClass = null; } - /** @phpstan-ignore-next-line */ - $updates = $this->request->input('updates') ?? []; - return [ - [ - 'component_class' => $componentClass, - 'component_alias' => $componentAlias, - 'component_id' => $componentId, - 'data' => $this->resolveData(), - 'updates' => $this->resolveUpdates($updates), - ], + 'component_class' => $componentClass, + 'component_alias' => $componentAlias, + 'component_id' => $componentId, + 'data' => $this->resolveData(), + 'updates' => $this->resolveUpdates(), ]; } @@ -112,8 +86,11 @@ protected function resolveData(): array } /** @return array */ - protected function resolveUpdates(array $updates): array + protected function resolveUpdates(): array { + /** @phpstan-ignore-next-line */ + $updates = $this->request->input('updates') ?? []; + return array_map(function (array $update) { $update['payload'] = Arr::except($update['payload'] ?? [], ['id']);