Possible Bug in Action ->disabled() and ->hidden()

I have added Filament action to a custom livewire page. The disabled function works a little odd, the condition changes to true/false but the ->action() would not execute. If i remove the disabled(), it works as expected. Can any one reproduce this?
public function nextPageAction(): Action
{
return Action::make('nextPage')
->button()
->disabled(fn () => $this->totalPages <= 1 || $this->page === $this->totalPages)
// ->hidden($this->totalPages <= 1 || $this->page === $this->totalPages)
->action(function () {
dd($this->page);
$this->nextPage();
});
}
public function nextPageAction(): Action
{
return Action::make('nextPage')
->button()
->disabled(fn () => $this->totalPages <= 1 || $this->page === $this->totalPages)
// ->hidden($this->totalPages <= 1 || $this->page === $this->totalPages)
->action(function () {
dd($this->page);
$this->nextPage();
});
}
Solution:
My bad, the totalPages must be a public property. I had protected ?int $totalPages = null; and changing it to public ?int $totalPages = null; worked.
Jump to solution
1 Reply
Solution
Mansoor Khan
Mansoor Khan9mo ago
My bad, the totalPages must be a public property. I had protected ?int $totalPages = null; and changing it to public ?int $totalPages = null; worked.
Want results from more Discord servers?
Add your server