Refreshing table records after a page action

Currently using this implementation, which works technically but the notification animation isn't smooth, probably due to some re-rendering of the whole ManagesPodcastEpisodes::class, is there a way to only refresh records and not the whole thing?
// ManagesPodcastEpisodes::class
protected $listeners = [
'cache-cleared' => '$refresh',
];

protected function getHeaderActions(): array
{
return [
Action::make('forceRefresh')
->label('Force Refresh')
->action(function (): void {
Cache::forget(PodcastEpisode::CACHE_KEY);
// Sushi will handle the rest

Notification::make()
->success()
->title('Podcast episodes refreshed.')
->send();

$this->dispatch('cache-cleared');
}),
];
}
// ManagesPodcastEpisodes::class
protected $listeners = [
'cache-cleared' => '$refresh',
];

protected function getHeaderActions(): array
{
return [
Action::make('forceRefresh')
->label('Force Refresh')
->action(function (): void {
Cache::forget(PodcastEpisode::CACHE_KEY);
// Sushi will handle the rest

Notification::make()
->success()
->title('Podcast episodes refreshed.')
->send();

$this->dispatch('cache-cleared');
}),
];
}
2 Replies
Dennis Koch
Dennis Koch2y ago
Not really. That's how Livewire works.
Oussama
OussamaOP2y ago
Alright thanks, I suppose it's good enough 😄

Did you find this page helpful?