Table on livewire component is involuntarily refreshing component on Action
I have a filament Table in a livewire component, with a simple Action:
I need to dispatch an event to let another livewire component on the page, containing an Infolist, know that a row has been clicked and that it should display data relevant to that row.
However, it seems that clicking on the row or the action button resets the component completely.
I noticed this since the component starts out hidden, and is displayed when it receives an event that's dispatched from a job queued by a third livewire component on the page containing a Form. Clicking any row hides the Table again, suggesting it's refreshing its $hidden property.
Maybe it's wrong from a design standpoint in the first place?
I'm just really lost
Solution:Jump to solution
I don't know what kind of trigger the action fires that causes the component to refreshIt's a Livewire request. Livewire components rerender on requests...
4 Replies
Can you explain that
$hidden
part and/or show some code?In the component:
In the view:
I've currently managed to keep the component from refreshing by saving a property that's being used in the table query with the
#[Url]
attribute
I don't know what kind of trigger the action fires that causes the component to refresh, but with this at least it looks like I'm firing the event I wanted to fire:
Though I don't know if this syntax changed anything from the arrow function, or the [#Url]
attribute is what's making it work, it's honestly a messIt's a
private
property. Those aren't sent to the frontend so it will be reset when the component is rerendered.Solution
I don't know what kind of trigger the action fires that causes the component to refreshIt's a Livewire request. Livewire components rerender on requests