I am trying to dispatch a job to the sync driver and run it after the page is rendered. Then status updates are send to the frontend using Laravel Echo.
The job class is created and working.
Livewire component is working.
Echo is working.
I am trying to call the dispatch from a livewire component after a form submit.
So what happens that is not working is afterResponse part.
// This inside the livewire component
ImportJob::dispatchAfterResponse( $data );
// or
dispatch( new ImportJob( $data ) )->afterResponse();
Both of them work and start the job what they do not do is afterResponse part.
if I chain the call into a non existing method it does render the page first, but of course then trows a error that there is no noneExistingMethod on null when the job is finished
ImportJob::dispatchAfterResponse( $data )->nonExistingMethod();
The issue is that the livewire component waits for the job to be finished before rendering the page. If I open the same page twice and submit one I can see the status updates come in one by one but on the page that submited the form the status updates are rendered all at onces after the job finished