php - Why does Livewire run a new query on each render and why are relationships lost
one text
Solution:
When selectUser()
method is triggered, the livewire will re-render the blade and since wire:init="readyToLoadUserList"
is there, it will load every user (again).
Replce readyToLoadUserList()
with mount()
and simply keep wire:init=""
empty.
Also, condition with @if($users->count() > 0)