Replace mounted action passing arguments

After executing one of my custom page action, I replace it with another action passing along arguments, but when I tried to die n dumped it in the send email action class it returned null. Could someone tell me what I'm doing wrong? The $data array wasn't null in after() method.
ViewOrder.php
protected function getActions(): array
    {
        return [
            PostService::make()
                ->after(function (array $data) {
                    if ($this->record->training->status()->is('Training Arranged')) {
                        $this->replaceMountedAction('sendEmail', $data);
                    }
                }),
        ];
    }

public function sendEmail() { return SendEmail::make();}

SendEmail.php
class SendEmail extends Action
{
    public static function getDefaultName(): ?string
    {
        return 'sendEmail';
    }

    protected function setUp(): void
    {
        parent::setUp();
        dd($this->arguments);
    }
Was this page helpful?