Updating record from extraItemsAction in Builder

I have a builder with an extraItemAction
$this->extraItemActions([
Action::make('toggleVisibility')
->icon(fn ($state, array $arguments) => $state[$arguments['item']]['data']['visible'] ? 'heroicon-o-eye' : 'heroicon-o-eye-slash')
->action(function (array $arguments, Builder $component) {
$state = $component->getState();
$state[$arguments['item']]['data']['visible'] = ! $state[$arguments['item']]['data']['visible'];

$component->state($state);
}),
...
$this->extraItemActions([
Action::make('toggleVisibility')
->icon(fn ($state, array $arguments) => $state[$arguments['item']]['data']['visible'] ? 'heroicon-o-eye' : 'heroicon-o-eye-slash')
->action(function (array $arguments, Builder $component) {
$state = $component->getState();
$state[$arguments['item']]['data']['visible'] = ! $state[$arguments['item']]['data']['visible'];

$component->state($state);
}),
...
How can I update the record after the action was fired?
1 Reply