Custom Field disappear after LiveWire update

One dev in my team created a PracticeMatrix custom field.
Everything was working fine until I added ->live(onBlur: true)->afterStateUpdated(fn (Set $set, ?string $state) => $set('slug', Str::slug($state))), to a TextField to automatically generate a Slug in TextInput::make('slug').

Now, when I blur the TextField, most of the BestPracticeMatrix component disappear and I don't know why.
The controller or the blade view are probably not correct, but I'm not familiar with LiveWire and filamentphp custom field.
I can't seem to find documentation on how to do custom field.

Does anybody knows why the field disappear ?
What I know so far is when the blur happen, LireWire update the page and the $practicesData = $getPracticesData(); is now an empty array so the @foreach in the template is not rendering anything.

Here is the code: https://gist.github.com/mrleblanc101/f05af5990556f92d8f983c8184dff089
Gist
GitHub Gist: instantly share code, notes, and snippets.
Solution
I guess so, first time using filament and livewire, and this code wasn't from me.
But it kinda feels wonky to call PHP methods from the template 😬
Seems like it should be in the Controller and passed down, but that's where it reset the array when LireWire update.
But i'm very unfamillar with how to pass data from the Controller to the field, there is basically zero documentation about that. Only how to do a very basic ViewField::make()
Was this page helpful?