Issue in using custom component within Repeater
* I created a custom page to manage Course content which extends Filament\Resources\Pages\EditRecord.
* Also, I created a custom component called ImportLessonMaterial which extends Filament\Forms\Components\Component
* in it's view filament/import-lesson-material.blade.php I call a liveware component called ImportLessonMaterial which extends Livewire\Component
The component itself works fine, but when i try to add new unit, or new lesson in the main page I face an issue that says
Uncaught Snapshot missing on Livewire component with id: 7VKNgVgSmdefeGmnuDl9
It goes if I remove the custom component from the schema, I'll attach all the related code in this thread.
Thanks!!13 Replies
The main edit page code:
ImportLessonMaterial Component code:
the filament.import-lesson-material blade:
the liveware import-lesson-material component code:
and its blade livewire.import-lesson-material:
the issue that i get in console when i try to create a new unit or lesson from the Repeater:
please see #❓┊help on how to format code
thanks for the note, updated.
IT looks like you are missing the key id of the elements
you should prefixed the markers with php
i.e.
'''php
I followed the docs (https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component#adding-the-form) to do what should be done to create a liveware component, idk what i am missing here.
Ok so you are trying to use a Repeater in a Repeater
I am using 3 nasted repeaters, but they are working fine.
Even if i use the ImportMaterialComponent without imorting the @liveware in its blade, it works fine. I believe that the issue is somewhere in the liveware component and they way of using it inside the form.
Does that livewire component render multiple times in the repeater? The elements I beleive likely need key in that component which is why it can't find the id
Yes, it renders with each lesson. And the page has multiples.
https://livewire.laravel.com/docs/understanding-nesting
Which would be
wire:id="123"
and the ID would be that of the lesson id
Laravel
Nesting | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
i used it here, but filament overrides these ids with other random ones. any thoughts? idk if the issue is really a duplicated IDs
I personally would suspect it's somethign arround binding state as this would generally hint to me that it tried to update a component but couldn't becuase it lost track of it.
https://filamentphp.com/docs/3.x/forms/fields/custom#obeying-state-binding-modifiers
But I am not really a hero in livewire so afraid I can't help further.