Action refresh Select field value
Hello, I'm building an action and trying to refresh the select field but I cannot make it work, can someone point me out how to do that?
Thank you in advance,
->action(function (array $data, Program $record, Select $component): void {
$statePath = $component->getStatePath();
$data['entity']['type'] = 'organizer';
$entity = Entity::create($data['entity']);
$users = !empty($data['users']) ? $data['users'] : [];
foreach ($users as $user) {
$user = User::create($user);
}
$record->entity()->associate($entity->id);
$record->save();
/** @var LivewireComponent $livewire */
$livewire = $component->getLivewire();
$livewire->dispatch('filament-forms::select.refreshSelectedOptionLabel', livewireId: $livewire->getId(), statePath: $statePath);
})->action(function (array $data, Program $record, Select $component): void {
$statePath = $component->getStatePath();
$data['entity']['type'] = 'organizer';
$entity = Entity::create($data['entity']);
$users = !empty($data['users']) ? $data['users'] : [];
foreach ($users as $user) {
$user = User::create($user);
}
$record->entity()->associate($entity->id);
$record->save();
/** @var LivewireComponent $livewire */
$livewire = $component->getLivewire();
$livewire->dispatch('filament-forms::select.refreshSelectedOptionLabel', livewireId: $livewire->getId(), statePath: $statePath);
})Thank you in advance,