AfterStateUpdate looks like it isnt working

Grid::make(2)->schema([
                    Select::make('chosen_asset')
                        ->label('Selecteer aan middel')
                        ->searchable()
                        ->options(
                            Asset::all()->map(function ($asset) {
                                return [
                                    'id' => $asset->id,
                                    'value' => $asset->name . ' - ' . $asset->brand,
                                ];
                            })->pluck('value', 'id')->toArray()
                        )
                        ->afterStateUpdated(
                            fn (Closure $set, $value) => $set('asset_id', $value)
                        )
                ]),

                Grid::make(2)->schema([
                    TextInput::make('asset_id')
                        ->label('Type'),


As you can see in the example above. I have a chosen asset select component. With values of assets. That is working fine. But when some value is selected i want to change other fields according to that.
I try to change the asset_id field below but nothing seems to be working. Can anyone help me with this?
Was this page helpful?