Notification Action - V4

I have a notification in my custom action class as a guide from this document.

I encounter an error Unable to call component method. Public method [mountAction] not found on component not sure if this is known issue in v4 beta-10.

here is my code snippet:

class DeleteRecordAction
{

    public static function make()
    {
        return Action::make('delete_record')
            ->label('Delete')
            ->hidden(static function (User $record): bool {
                if (! method_exists($record, 'trashed')) {
                    return false;
                }

                return $record->trashed();
            })
            ->defaultColor('danger')
            ->tableIcon(Heroicon::Trash)
            ->groupedIcon(Heroicon::Trash)
            ->modalIcon(Heroicon::OutlinedTrash)
            ->modalHeading(fn (): string => __('filament-actions::delete.single.modal.heading', ['label' => 'Record']))
            ->requiresConfirmation()
            ->action(function (User $record){
                $result = (bool) $record->delete();
                if (! $result) {
                    Notification::make()
                        ->title('Something went wrong')
                        ->body('Unable to delete record.')
                        ->color('danger')
                        ->send();
                }
                Notification::make()
                    ->title('Deleted successfully')
                    ->body('Record successfully deleted.')
                    ->color('success')
                    ->duration(6500) // 6.5 sec
                    ->actions([
                        Action::make('Undo')
                            ->button()
                            ->action(fn(User $model) => $model->restore()) // => This cause an error
                    ])
                    ->send();
            });
    }
Solution
only URLs and dispatches, not function calls
Was this page helpful?