Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirecting to a download in an Action within a modal causes the modal to reopen on next close #15141

Open
ahamilton9 opened this issue Dec 19, 2024 · 1 comment
Labels

Comments

@ahamilton9
Copy link

Package

filament/filament

Package Version

v3.2.131

Laravel Version

v11.36.1

Livewire Version

v3.5.12

PHP Version

PHP 8.3.14

Problem description

After clicking on an Action that is set to redirect to a download attachment URL (that will open the download dialog) inside a modal, then closing the modal, the modal reopens one time.

Expected behavior

That the modal does not reopen at all.

Steps to reproduce

In the reproduction repository:

  • composer install, php artisan key:generate, php artisan migrate --seed
  • Head to /admin
  • Login as [email protected] password test
  • Click on the "Test" page
  • Click on the "Actions" header action in the top right
  • Click on the "Download" Action (will try to download Github Desktop)
  • Cancel or Accept
  • Click "Close"
  • Note the modal reopens. Close again
  • Modal closes properly

The related code is in app/Filament/Pages/Test.php:

Action::make('actions')
    ->modal()
    ->extraModalFooterActions([
        Action::make('download')
            ->action(function() {
                // This works, but causes the containing modal to reopen when it is next closed.
                // I cannot use url() instead of action() because I also need to run other logic.
                $this->redirect('https://central.github.com/deployments/desktop/desktop/latest/win32');
            })
        ])

Reproduction repository (issue will be closed if this is not valid)

https://github.com/ahamilton9/filament-issue

Relevant log output

No response

@tonypartridge
Copy link
Contributor

tonypartridge commented Dec 23, 2024

You should be able to use URL with a closure?

->extraModalFooterActions([
    Action::make('download')
        ->url(fn($record) => 'https://central.github.com/deployments/desktop/desktop/latest/win32')
        ->openUrlInNewTab(),
])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

2 participants