wire:loading Not Triggering During Action Dispatch in Filament

I'm having trouble getting the wire:loading indicator to show when dispatching an event from a Filament action. The action works, but the loading spinner doesn’t appear. Here's the code I'm using: Tables\Actions\Action::make('test') ->dispatch('triggerPrint', ['action' => 'print', 'element' => 1]), Does anyone know how to fix this or get wire:loading to work with action dispatch? Thanks!
1 Reply
torgodly
torgodlyOP5d ago
I solved the issue by directly using the $livewire instance inside the action method, instead of calling the dispatch method on the class itself. The updated code looks like this: Tables\Actions\Action::make('test') ->action(function ($record, $livewire) { $livewire->dispatch('triggerPrint', ...['action' => 'print', 'element' => 1]); }), The key difference is that you need to flatten the array of parameters when using the spread operator (...).
Want results from more Discord servers?
Add your server