Multiple Infolists in Form not rendering when ->live function is being used by any component

I want to display some information inside of the edit function of a Model I have. For this I have a method that loops through related Models which adds a Section to the Form for each Model. Each Section consists of this:
Forms\Components\Section::make()
->description(Str::limit($model->subject))
->collapsible()
->collapsed($collection->last() !== $model)
->compact()
->schema([
Forms\Components\View::make('filament.forms.components.model.history.body')
//->view('filament.forms.components.model.history.body')
->viewData([
'model' => $model,
]),
]);
Forms\Components\Section::make()
->description(Str::limit($model->subject))
->collapsible()
->collapsed($collection->last() !== $model)
->compact()
->schema([
Forms\Components\View::make('filament.forms.components.model.history.body')
//->view('filament.forms.components.model.history.body')
->viewData([
'model' => $model,
]),
]);
I use the View component so I can render the infolist using a custom Livewire component as described in the docs (https://filamentphp.com/docs/3.x/infolists/adding-an-infolist-to-a-livewire-component) The issue persists even with the simplest of the simple Infolists such as:
public function contentInfolist(Infolist $infolist): Infolist
{
return $infolist
->state(['test' => 'Cooltexthere'])
->schema([
TextEntry::make('test')
]);
}
public function contentInfolist(Infolist $infolist): Infolist
{
return $infolist
->state(['test' => 'Cooltexthere'])
->schema([
TextEntry::make('test')
]);
}
This now results in there being a list of Sections in the Form which all have the livewire infolist content rendered. So far everything is working as intended. When I however add another Form Component which has the ->live() attribute (and I type in the form field) every but the last rendered info list (from the multiple inside of the multiple sections) will be cleared and have no content at all. Adding some static HTML to the blade view "filament.forms.components.model.history.body" or even the one of the livewire component this gets displayed. The infolist however won't be displayed. I assume the issue has to do with livewire refreshing something due top the ->live() function. Does anyone know of such restrictions?
1 Reply
skyracer2012
skyracer2012OP15mo ago
I am not sure if this is a bug or some caching feature I however was not able to figure out how and why this happens. UPDATE: Disableing the view cache fixes the issue. I am still not sure where it comes from. I fixed it with just creating a new Livewire component and then rendering the Infolist with the ->toHTML Method and then passing the html into a blade view that renders that html unescaped. The infolist seems to be XSS resistant as far as I tested it. The original issue is still present though. Will mark this as done because I did fix my problem.
Want results from more Discord servers?
Add your server