Validate form from custom Action button - maybe bug

I've added custom action button on resource edit page and I want to validate form before proceeding with action. There is strange bug or weird behaviour. This is my action button:

class EditTask extends EditRecord
{
    protected static string $resource = TaskResource::class;

    protected function getHeaderActions(): array
    {
        return [
            Actions\Action::make('Complete task')
                ->action(function () {
                    // I've found somewhere on discord that this validates form.
                    // It does but only the first time when this action is executed,
                    // if you click on the button again then empty modal is opened
                    // with two buttons Submit and Cancel ?!?
                    $this->form->getState();
                    
                    // after validation form should be saved
                    $this->save();

                    // the rest of action code should be here
                }),
            Actions\ViewAction::make(),
            Actions\DeleteAction::make(),
        ];
    }
}
Was this page helpful?