Certainly! The issue you’re facing is likely due to the use of formatStateUsing(fn (string $state): string => dump(ucfirst($state))).
The dump() function is for debugging purposes and will output data immediately to the browser, stopping normal execution and rendering of the component. Because of this, the frontend cannot update or react the way it should (including Livewire’s live updating system, which Filament uses under the hood).
To fix the issue, remove the dump() from the formatStateUsing callback. Instead, simply return the formatted value:
->formatStateUsing(fn (string $state): string => ucfirst($state))
Here’s your corrected code:
Select::make('meta.contains_unit')
->label('')
->options([
PropertyContainsUnitEnum::SingleRentable->value => 'Single Unit',
PropertyContainsUnitEnum::MultipleRentable->value => 'Multiple Units',
])
->default(PropertyContainsUnitEnum::MultipleRentable->value)
->required()
->reactive()
->columns(2)
->formatStateUsing(fn (string $state): string => ucfirst($state))
// ->descriptions([
// PropertyContainsUnitEnum::SingleRentable->value => 'Property with one rentable unit',
// PropertyContainsUnitEnum::MultipleRentable->value => 'Property with multiple rentable units',
// ])
->live(),
Summary:
- Remove
dump()from the callback. - Only use debugging helpers like
dump()when debugging, not in production callbacks. - The
->live()should now properly update the data as expected.
If you need to debug, use dump() temporarily without reloading the page, or inspect Livewire component states via browser dev tools or Livewire’s inspector.