I have a Laravel with HTML application that I am adding Livewire to, I have noticed that Livewire requests are taking around 1 second to process. For example I have a component which is currently only rendering 4 records
public function render(): View
{
$this->authorize('viewAny', Region::class);
return view('livewire.region-manager', [
'regions' => Region::when($this->region, function ($query) {
$query->where('name', 'like', '%'.$this->region.'%');
})
->paginate($this->perPage),
]);
}
in the blade file I have an input with wire:model.live. when I search, the component takes around 1s to update. Do I have to create a Livewire app from the initial setup?
Using wire:model.live can fire off multiple requests depending on how fast the user types. By default, Livewire adds a 150ms "debounce" to the input. This means it waits 150ms until after the user has finished typing to perform the update.
I have a similar search-style component that paginates through about 200 records. On the server, updates take an average of around 600ms to complete. I have the "search" input debounced at 300ms.
As a note, the OS of your development environment could also play a part in slow requests. I work primarily on Windows which adds a fair bit of overhead when testing things locally (at least in my experience).