Toggle column is not updating until page refresh

ToggleIconColumn::make('favorite')
->onIcon('heroicon-s-star')
->offIcon('heroicon-o-star')
->updateStateUsing(fn (ResourceModel $record) => $record->isFavorite() ? $record->unsetFavorite() : $record->setFavorite())
->getStateUsing(fn (ResourceModel $record) => $record->isFavorite())
ToggleIconColumn::make('favorite')
->onIcon('heroicon-s-star')
->offIcon('heroicon-o-star')
->updateStateUsing(fn (ResourceModel $record) => $record->isFavorite() ? $record->unsetFavorite() : $record->setFavorite())
->getStateUsing(fn (ResourceModel $record) => $record->isFavorite())
The code updates the database properly but does not show the change in the table until the page is refreshed. (favorite is determined from a resource_user pivot table)
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server