Defer loading on a widget
Following livewire's docs I don't seem to be able to get this working, has anyone had success deferring loading on a widget?
class MyWidget extends BaseWidget
{
public bool $readyToLoad = false;
public function loadData()
{
$this->readyToLoad = true;
}
protected function getStats(): array
{
if (! $this->readyToLoad) {
return [
Stat::make('Loading', 'Loading...')
];
}
sleep (5);
return [
Stat::make('Loaded Widget', 'Done!'),
];
}
}$isLazy = true;
public function placeholder(): View
{
return view('loading');
}<!-- resources/views/loading.blade.php -->
<div>loading..</div>use Illuminate\Contracts\View\View;$isLazy = true;
public function placeholder(): View
{
return view('loading');
}<!-- resources/views/loading.blade.php -->
<div>loading..</div>Could not check compatibility between App\Filament\Widgets\MyWidget::placeholder(): App\Filament\Widgets\View and Filament\Widgets\Widget::placeholder(): Illuminate\Contracts\View\View, because class App\Filament\Widgets\View is not available