Filament color is not reactive
At first, i found out the badge color inside table doesn't update alone with the text.
For example, when the
status
value is changed from activated
to deactivated
, the text inside badge will update to the getLabel() value, however, the color of the badge stay the same. I thought it was an issue relating to badge.
The text column code:
The enum status code:
Upon some more troubleshooting, i realized all colors are not reactive.
Even when i have a method that dynamically return filament action, lets say ban
or unban
action, which has danger or success color. The dynamic action will update based on user status, however, the color of the action itself doesnt change.7 Replies
Are you using something like this in the action?
The color will render correctly initially, both badge and action text label, icon works fine, its just the color doesn't update unless the whole page refresh.
Try using
->visible()
/->hidden()
on the action instead of returning different actiosn
I have tried toggle, same thing happend. The ban and unban label will update according to user status, and the badge label on table and infolist will update too, but none of the color update unless the page refresh.
Are you on the latest versions of Filament and Livewire?
Even hard coding to color into action result the same, action will render correct label, the color doesn't change. For example, when
ban
button (red color) is triggered, now it updates and should render unban
button (green color), it does update the text to unban, but color is still red. After a page refresh, it correctlly display the color to green.
Yes, i'm on "filament/filament": "^3.2", and livewire v3.5.12
I don't know if this will help, but when the button rerender, everything inside <button> tag updates, excepts for style, which of course decide the color.
I've run composer update on both livewire an filament, still not sure where exactlly the issue were, but it seems to fixed. Thanks!