Download action button behaves weirdly

I have a table action that redirects the user to this route ('tickets/{id}/files')

Tables\Actions\Action::make('download_all_files')
    ->label('Download All Files')
    ->icon('heroicon-m-arrow-down-on-square-stack')
    ->color('primary')
    ->hidden(!(auth()->user()->can('can_download_all_files_ticket')))
    ->action(function (Ticket $record): void {
        Redirect::to('/tickets/' . $record->id . '/files');
    }),

Everything in the
__invoke 
function is working fine and I am able to download all the ticket's files in a zip format

public function __invoke(Request $request)
{
    // ...
    $files = $ticket->getMedia();
    if (count($files) === 0) {
        Notification::make()
            ->title('No files to download')
            ->warning()
            ->send();
        return redirect()->back();
    }
    $zip = new ZipArchive();
    $fileName = 'ticket-' . $ticket->ticket_identifier . '-attachments.zip';
    $zip->open($fileName, ZipArchive::CREATE | ZipArchive::OVERWRITE);
    foreach ($files as $file) {
        $filePath = storage_path('app/public/' . $file);
        $zip->addFile($filePath, $file);
    }
    $zip->close();
    Notification::make()
        ->title('Files downloaded')
        ->success()
        ->send();
    return response()->download($fileName)->deleteFileAfterSend(true);
}

After downloading the zip file there are two notifications, why?
When I click the button again, an empty form appears. Pressing the submit button downloads the files.
When I click the button again on another row, the pervious file is downloaded again
What causes these issues?
Screenshot_2023-12-20_173553.png
Screenshot_2023-12-20_173909.png
Screenshot_2023-12-20_174009.png
Was this page helpful?