Action causes error: TypeError: Cannot convert undefined or null to object

I have an action button which is only visible when a certain filter is enabled:
Tables\Actions\Action::make('approve')
->icon('heroicon-s-check')
->action(function (Product $record) {
$record->reviewed_at = now();
$record->needs_attention = false;
$record->save();
})
->visible(fn ($livewire) => $livewire->tableFilters['review']['isActive']),
Tables\Actions\Action::make('approve')
->icon('heroicon-s-check')
->action(function (Product $record) {
$record->reviewed_at = now();
$record->needs_attention = false;
$record->save();
})
->visible(fn ($livewire) => $livewire->tableFilters['review']['isActive']),
When filter is enabled and I press approve on the row. The row should disappear from the table because the row doesn't comply with the conditions of the filter. So When I press the Action button I get the following livewire error (See screenshot) My question is how can I handle this. Maybe the page should refresh after the action is finished.
No description
1 Reply
JJSanders
JJSanders2mo ago
Hi, Does anyone have an idea on how to solve this ?