getHeaderAction action visible does not refresh until second click

Using panel builder I have a Actions\Action setup in the ListModels.php that sets a database field in all records outstanding to a date. The visible() checks for any records that don't have a date and if there are none it is not visible. It stays visible until the second click. Here is the code and I did pair it down. So you click the first action download and it updates a models datetime and downloads a file. Then it uses that datetime field to determine if it should be visible. Once there are no more models without that datetime null it should hide the first download action and then show the second download_success action. What happens is this. You click the first action and it does the work. But the visibility of both actions stays the same. Then if you click the first actions button again it changes from the first action being visible to the second action being visible which is what it should do with the first click. So it is like livewire is not updating the visibility. I have this working perfectly in Tables\Actions\Action with the ModelResource.php table actions. When you click the first action there it works perfect. Am I missing some sort of livewire method?
Actions\Action::make('download')
->action(function () {
if (Storage::disk('storage')->exists("file.zip")) {
Model::updateAllQueuedDownloads();
return Storage::disk('storage')->download('file.zip', 'file.zip');
}
})
->visible(Model::ModelQueued()->count()),
Actions\Action::make('download_success')
->action(function () {
Storage::disk('storage')->move('file.zip', 'file_backup_' . Carbon::now()->format('YmdHis') .'.zip');
return redirect('someurl');
})
->visible(!Model::ModelQueued()->count()),
Actions\Action::make('download')
->action(function () {
if (Storage::disk('storage')->exists("file.zip")) {
Model::updateAllQueuedDownloads();
return Storage::disk('storage')->download('file.zip', 'file.zip');
}
})
->visible(Model::ModelQueued()->count()),
Actions\Action::make('download_success')
->action(function () {
Storage::disk('storage')->move('file.zip', 'file_backup_' . Carbon::now()->format('YmdHis') .'.zip');
return redirect('someurl');
})
->visible(!Model::ModelQueued()->count()),
0 Replies
No replies yetBe the first to reply to this messageJoin