F
Filament4d ago
dyo

Problem with wire:init and $this->table in custom page

Why does wire:init prevent $this->table from appearing, while the method is being executed on the custom page? Even though the method called in wire:init has nothing to do with the table method in the component.
4 Replies
Andrew Wallo
Andrew Wallo4d ago
What does the method in wire:init do?
dyo
dyo3d ago
I have a label list to show in other part of page, that take quite long time to run the query. So I want to seperate the load between the data of the table and label data. The init is to trigger the label query. This is my simplified blade structure for the case
<div>
<div >
@foreach ($label as $item)
<div>{{ $item }}</div>
@endforeach
</div>
<div>
{{ $this->table }}
</div>
</div>
<div>
<div >
@foreach ($label as $item)
<div>{{ $item }}</div>
@endforeach
</div>
<div>
{{ $this->table }}
</div>
</div>
The filament table is using deferLoading method Can someone help me?
Andrew Wallo
Andrew Wallo3d ago
If the init is just to trigger the label query then why not just trigger it in mount? Or even use a computed property
dyo
dyo3d ago
the label query only could take more than 10s to run.. if it's in mount, then the whole page will be slow to open..
Want results from more Discord servers?
Add your server
More Posts