livewire component doesn't refresh fully after emit from another component, It displays some missing part. Is there any fix to this?
My livewire component
class AllStaffs extends Component
{
// public $staffs;
use WithPagination;
protected $listeners = ['addedStaff' => 'render',
'editedStaff' => 'render',
'render'];
public function delete($id)
{
User::destroy($id);
$this->emitSelf('render');
$this->dispatchBrowserEvent('staff-deleted');
session()->flash('success', 'Staff Deleted Successfully 😃!');
}
public function render()
{
$roles = Role::all();
$staffs = User::latest()->paginate(10);
// $staffs = $this->staffs;
return view('livewire.all-staffs', compact('staffs', 'roles'));
}
}
I solved it using the troubleshooting section of livewire docs set the wire key on each table wire:key="foo"