Hello guys! I want to apologize first if my english is not perfect since I am french.
So to briefly resume what is happening, I have livewire page for seat reservation like at a cinema. Everything works well, you can select/deselect seats, pay, everything,...
The problem is that we needed to implement something to be able to specify a specific user in a modal via a select tag, for that I need to load all users in the database in the mount function (we have around 10K users) and use it in the blade file. Except it increases all the queries other that are happening by 1.5s approximately. For example clicking on a seat takes 2s instead of ~300ms to change from 'available' to 'reserved' with the color change. I don't know why, since I just load it in the mount function and it is not used nor refreshed elsewhere, if someone could help me it would be much appreciated.
This is the code (I just started Livewire I may be missing important points) :
public $allMembers;
public function mount($spectacleid)
{
...
$this->allMembers = User::all();
}
And in the blade I have this :
<select name="user-reservation" id="user-reservation" class="form-control" required wire:ignore>
@foreach ($allMembers as $user)
<option value="{{ $user->user_id }}">{{ $user->lastname }}
{{ $user->name }}
</option>
@endforeach
</select>
Removing the foreach in the blade doesn't change everything, the times reduces only when i remove this line :
$this->allMembers = User::all();`