there seems to be no difference when using disabled vs visible in action

It seems that using the visible method on an Action just disables the action, it doesn't actually hide it.
public function rerunAction(): \Filament\Actions\Action
{
return \Filament\Actions\Action::make('rerunAction')
->label('')
->visible(fn () => auth()->user()->isSysAdmin())
->iconButton()
->icon('heroicon-o-arrow-path')
->tooltip('Rerun')
->color('primary')
->action(fn () => $this->rerun());
}
public function rerunAction(): \Filament\Actions\Action
{
return \Filament\Actions\Action::make('rerunAction')
->label('')
->visible(fn () => auth()->user()->isSysAdmin())
->iconButton()
->icon('heroicon-o-arrow-path')
->tooltip('Rerun')
->color('primary')
->action(fn () => $this->rerun());
}
It might be hard to tell in the screenshots, but one user session is a sys admin and the other is not. It's handled correctly if the method were disabled(), but it's visible. This is on a livewire component action.
No description
No description
3 Replies
Jon Mason
Jon MasonOP8mo ago
I feel like there was a way to do this within the blade file and I can't seem to find it in the docs, but maybe I need to try that as a work-around.
Jon Mason
Jon MasonOP8mo ago
I guess you have to define use the visible method on the action and also add the conditional in the blade file.
Want results from more Discord servers?
Add your server