You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$arguments is empty inside the visible closure on an Action (Filament\Actions\Action) when provided through a blade file. The arguments work fine in other closures (see modalDescription)
public function testVisibleAction(): Action
{
return Action::make('testVisible')
->visible(fn(array $arguments) => dd($arguments))
->requiresConfirmation()
->modalDescription(fn(array $arguments) => 'Message from arguments:' . $arguments['message'])
->action(fn() => Notification::make()->success()->title('testVisible Success')->send());
}
Result:
[] // app/Livewire/SubscriptionManagement.php:134
Using $arguments inside the closure causes the button to become disabled even when the result returns true from that closure. If you have other actions on the page and then activate one, the actions that use $arguments within the closure disappear from the page while the new modal is open, and reappear when its closed.
===================
The repo can be spun up using Laravel sail for ease.
composer install && npm install
./vendor/bin/sail up
./vendor/bin/sail npm run dev
Same login credentials as the example for test panel:
Showing 2 buttons disabled when they should be enabled.
After clicking on an enabled action, those actions using $arguments inside the closure are hidden.
NOTE: If the result of the closure is false, then it hides the button correctly.
Expected behavior
$arguments inside the visible closure should be populated if arguments are present.
Using $arguements inside the visible closure should show an enabled action if the result of that closure is true.
Steps to reproduce
Since I used sail in the repo, I'll use it in these steps as well.
Create a custom page - sail artisan make:filament-page TestAction
Add required traits and interfaces to new page -
use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Actions\Contracts\HasActions;
class TestAction extends Page implements HasActions
{
use InteractsWithActions;
Create 2 actions - this will allow you to test the disappearing and reappearing bug.
public function testVisibleAction(): Action
{
return Action::make('testVisible')
->visible(fn(array $arguments): bool => count($arguments) == 0)
->requiresConfirmation()
->modalDescription(fn(array $arguments) => 'Message from arguments:' . $arguments['message'])
->action(fn() => Notification::make()->success()->title('testVisible Success')->send());
}
public function testVisibleHardCodedAction(): Action
{
return Action::make('testVisibleHardCoded')
->visible(true)
->requiresConfirmation()
->modalDescription(fn(array $arguments) => 'Message from arguments:' . $arguments['message'])
->action(fn() => Notification::make()->success()->title('testVisibleHardCoded Success')->send());
}
Add action and visibility check into blade file (along with action modals blade).
Package
filament/actions
Package Version
v3.2.115
Laravel Version
v11.25.0
Livewire Version
v3.5.6
PHP Version
PHP 8.3
Problem description
There are 2 main bugs in the provided repo:
$arguments
is empty inside the visible closure on an Action (Filament\Actions\Action
) when provided through a blade file. The arguments work fine in other closures (see modalDescription)Result:
$arguments
inside the closure causes the button to become disabled even when the result returns true from that closure. If you have other actions on the page and then activate one, the actions that use$arguments
within the closure disappear from the page while the new modal is open, and reappear when its closed.===================
The repo can be spun up using Laravel sail for ease.
Same login credentials as the example for test panel:
Showing 2 buttons disabled when they should be enabled.
After clicking on an enabled action, those actions using
$arguments
inside the closure are hidden.NOTE: If the result of the closure is false, then it hides the button correctly.
Expected behavior
$arguments
inside the visible closure should be populated if arguments are present.Using
$arguements
inside the visible closure should show an enabled action if the result of that closure is true.Steps to reproduce
Since I used sail in the repo, I'll use it in these steps as well.
sail artisan make:filament-page TestAction
Reproduction repository (issue will be closed if this is not valid)
https://github.com/Kane-R-G/filament-action-bug
Relevant log output
No response
Donate 💰 to fund this issue
The text was updated successfully, but these errors were encountered: