Header action button not refreshing
I have a header action that has a conditional color() and action() it looks like this:
->color(fn () => $this->user->is_tracking ? Color::Orange : Color::Green)
->action(fn () => $this->user->is_tracking ? $this->user->stopTracking() : $this->user->startTracking())
The stopTracking() and startTracking() function toggle the $this->user->is_tracking variable
The problem is that for some reason, the button doesnt refresh (change color) the first time i press it.
It executes the action without problems, but the color doesnt change, i have to press it twice, then it changes to orange. its pretty weird, any help would be apreciated
2 Replies