© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
48 replies
mrleblanc101

Custom Field disappear after LiveWire update

One dev in my team created a
PracticeMatrix
PracticeMatrix
custom field.
Everything was working fine until I added
->live(onBlur: true)->afterStateUpdated(fn (Set $set, ?string $state) => $set('slug', Str::slug($state))),
->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')
TextInput::make('slug')
.

Now, when I
blur
blur
the
TextField
TextField
, most of the
BestPracticeMatrix
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();
$practicesData = $getPracticesData();
is now an empty array so the
@foreach
@foreach
in the template is not rendering anything.

Here is the code: https://gist.github.com/mrleblanc101/f05af5990556f92d8f983c8184dff089
2024-08-08_16.28.03.gif
message.txt4.73KB
message.txt4.73KB
Gist
PracticeMatrix.php
GitHub Gist: instantly share code, notes, and snippets.
PracticeMatrix.php
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()
ViewField::make()
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Blade components disappear after livewire event
FilamentFFilament / ❓┊help
15mo ago
Custom form field and Custom Livewire component
FilamentFFilament / ❓┊help
2y ago
Custom action triggers /livewire/update
FilamentFFilament / ❓┊help
2y ago
livewire modal closes after update
FilamentFFilament / ❓┊help
7mo ago