filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
19.29k stars 2.96k forks source link

Select createOptionUsing not filled #9144

Closed sweebee closed 1 year ago

sweebee commented 1 year ago

Package

filament/forms

Package Version

v3.0.78

Laravel Version

v10.28.0

Livewire Version

v3.0.8

PHP Version

8.2

Problem description

When using a select with createOptionUsing, the select field is not updated the the correct selected value.

Forms\Components\Select::make('group_id')
                                           ->options(Group::pluck('name', 'id'))
                                           ->createOptionForm([
                                               Forms\Components\TextInput::make('name')->label('Naam'),
                                           ])
                                           ->createOptionUsing(function($data){
                                                $group = new Group();
                                                $group->name = $data['name'];
                                                $group->save();
                                                return $group->id;
                                           })
                                           ->label('Groep')
                ]),

When adding ->searchable() it works fine.

Expected behavior

Select new added entry

Steps to reproduce

in the admin panel add a new supporter and add a group.

https://github.com/filamentphp/filament/assets/10496485/450ac271-cf4e-4efc-ae25-ee53b2f3dbd7

Reproduction repository

https://github.com/sweebee/filamentv3octane/blob/master/app/Filament/Resources/SupporterResource.php#L37

Relevant log output

No response

zepfietje commented 1 year ago

@sweebee, could be a duplicate of https://github.com/filamentphp/filament/issues/8972 https://github.com/filamentphp/filament/pull/8633 https://github.com/livewire/livewire/pull/6889?

sweebee commented 1 year ago

@zepfietje ah yes, didn't search hard enough.

zepfietje commented 1 year ago

No worries, since you don't expect it to be the exact same underlying issue. 🙂

zepfietje commented 1 year ago

We simply need a fix for the failing test in the Livewire repo.