Have to refresh custom page for action's model to 'click' after running other action.

I have a custom page 'Tools' that prints a PDF which works fine. It uses a model to select from a list and then the user presses Submit . But if I first run another Action that displays data on the page the model's Submit button will not 'click' until after page refresh.
The page is a simple blade directive @if(ownName) that has a table inside. The action populates the $this->ownName. This modal becomes un-clickable
Action::make('genSchedPdf')
->label('Generate Schedule PDF')
->action('genSchedPdf')
->form([
Select::make('location')
->options(Location::query()->pluck('name', 'id'))
->required()
->default(1)
->disablePlaceholderSelection(),
]),
Action::make('genSchedPdf')
->label('Generate Schedule PDF')
->action('genSchedPdf')
->form([
Select::make('location')
->options(Location::query()->pluck('name', 'id'))
->required()
->default(1)
->disablePlaceholderSelection(),
]),

public function genSchedPdf($data)
{

$filePath = 'storage/schedule.pdf';
$pdf = new SchedPdfController;
$pdf->generatePdf($filePath, $data['location']);

Notification::make()
->title('Generation complete.')
->success()
->send();

return response()->download($filePath);
}

public function genSchedPdf($data)
{

$filePath = 'storage/schedule.pdf';
$pdf = new SchedPdfController;
$pdf->generatePdf($filePath, $data['location']);

Notification::make()
->title('Generation complete.')
->success()
->send();

return response()->download($filePath);
}
14 Replies
ddoddsr
ddoddsrOP2y ago
Maybe I should call it a "form" not a modal if that distinction makes a difference
Patrick Boivin
@ddoddsr Would you be able to do a short screen recording of the issue?
ddoddsr
ddoddsrOP2y ago
I'll give it a try. have to gt some dummy dataJust noticed that forms or modals both do not submit after the action that displays data, Not getting the screen recording yet, havent done one before. However when the action returns empty data so that it does not write to the for each, the modals / forms are not effected Screen recording
Patrick Boivin
Not seeing anything @ddoddsr
ddoddsr
ddoddsrOP2y ago
hdaklue
hdaklue2y ago
try having a global $location state that keeps track of the values you want to change
Patrick Boivin
Thanks for the recording @ddoddsr , it helps I'm not sure but I suspect the issue might come from the download response... Just a thought, instead of :
return response()->download($filePath);
return response()->download($filePath);
can you show a link in the page? Something like :
<a href="{{ $filePath }}" download>Download PDF</a>
<a href="{{ $filePath }}" download>Download PDF</a>
ddoddsr
ddoddsrOP2y ago
I'll give that a try That won't really fit for me. The user would have to leave the selection for and fine the button to click. I t works smoothly except for this glitch after another Action displays data on the blade page.
Patrick Boivin
Yes, I understand. I don't think I have the experience to help you with this one, unfortunately. I'm not sure if the issue is with the download response or something else...
ddoddsr
ddoddsrOP2y ago
Thanks for taking a look!
awcodes
awcodes2y ago
Any console errors.?
ddoddsr
ddoddsrOP2y ago
No console errors
awcodes
awcodes2y ago
Hmm. Just trying to figure out if it’s livewire or alpine issue.
ddoddsr
ddoddsrOP2y ago
right. simple page <x-filament::page> some @if ... with $foreach .. @endforeach @endif </x-filament::page>
Want results from more Discord servers?
Add your server