Modal in getHeaderActions keeps submitting parent form

I might just be bad at RTFM'ing, but whatever I do my submit action in my modal in getHeaderActions keeps trying to submit the actual resource form. The action:
Action::make('save_as_template')
                ->label('Save as Template')
                ->icon('heroicon-o-document-duplicate')
                ->modal()
                ->modalHeading('Save Form as Template')
                ->modalSubmitActionLabel('Save')
                ->form([
                    TextInput::make('template_name')
                        ->label('Template Name')
                        ->required(),
                ])
                ->action(function (array $data, $livewire): void {
                    $resourceName = Str::of(static::$resource)
                        ->afterLast('\\')
                        ->before('Resource')
                        ->snake()
                        ->toString();

                    FormTemplate::create([
                        'name' => $data['template_name'],
                        'resource' => $resourceName,
                        'data' => $livewire->form->getState(),
                    ]);

                    $livewire->notify('success', 'Template saved');
                })
                ->closeModalByClickingAway(false),

Anything to stop this from happening? I just need the modal form to be submitted, in this case save the form template, not the whole resource with it.
Was this page helpful?