How to update Filament View dispatching from a Livewire Component?
I've created a new component and used it inside a Filament View.
I've set up a listener on the ClientView as shown below:
protected $listeners = [
'refreshViewClient' => '$refresh'
];
And I'm calling $this->dispatch('refreshViewClient'); But for some reason, this specific component is not updating along with the entire screen.
For example, within the Header, I have a custom component where I call it as mentioned above, and it works perfectly. However, inside this particular component, it's not working.
This issue occurs whether I try to update the component -> view or view -> component; neither works.
Solution:Jump to solution
Solved.
The problem was because I were getting my action inside another component.
So I added:...
5 Replies


It seems like my main view doesn't have access to activities and vice versa to updating state...
I also tried to create a refresh listener inside my Livewire component.
protected $listeners = [
'refreshActivity' => '$refresh',
];
And call:
$this->dispatch('refreshActivity');
It works in some places but on "Send Email" for example, which is also a Livewire component, it doesn't work.
Example:

I've posted to https://gist.github.com/leoblanski/8287dafe55270d038a85f1160a84e581
The problem is with SendEmailAction.
Badge for example is also an LW component but it works.
Solution
Solved.
The problem was because I were getting my action inside another component.
So I added:
public function getEmailAction()
{
return app(SendEmailAction::class)
->mount($this->record, 'client')
->sendEmailAction()
->after(function () {
$this->dispatch('refreshActivity');
});
}