Action is always loading when running a laravel process

The main goal is to run a laravel process that starts a local game server. However, after running the process (and while its running) the action is always "loading" as shown in the picture. I understand why this is happening, but I was wondering if there was a way to get around it? After clicking launch, it should start the process and stop loading. Here is my code so far
<?php

namespace App\Filament\Pages;

class extends Page
{
protected function getHeaderActions(): array
{
return [
Action::make('launchAction')
->color('success')
->label('Launch Server')
->after(function () {
// ...
try {
$process = Process::fromShellCommandline($command, $mcDir);
$process->setTimeout(null);

// Async process
$process->start();

} catch (Exception $e) {
Log::error('Failed to launch server: ' . $e->getMessage());
throw $e;
}
}),
];
}
}
<?php

namespace App\Filament\Pages;

class extends Page
{
protected function getHeaderActions(): array
{
return [
Action::make('launchAction')
->color('success')
->label('Launch Server')
->after(function () {
// ...
try {
$process = Process::fromShellCommandline($command, $mcDir);
$process->setTimeout(null);

// Async process
$process->start();

} catch (Exception $e) {
Log::error('Failed to launch server: ' . $e->getMessage());
throw $e;
}
}),
];
}
}
No description
Solution:
I would look into jobs and listeners and how you can leverage them with reverb.
Jump to solution
6 Replies
awcodes
awcodes2mo ago
Why do you think this is happening?
Matthew
MatthewOP2mo ago
From what I understand, the ->action() creates a lifecycle And as long as the process is running, the lifecycle is active So until it ends, it will "load"
awcodes
awcodes2mo ago
So you’re starting a long running process and expecting livewire to return a signal that the process is done even though it isn’t.? Sounds like a use case for reverb and / or websockets to me instead of livewire.
Matthew
MatthewOP2mo ago
Hmm, but filament uses livewire anyways. How can I avoid livewire? If the server starts correctly with no errors, then is should stop loading.
Solution
awcodes
awcodes2mo ago
I would look into jobs and listeners and how you can leverage them with reverb.
Matthew
MatthewOP2mo ago
thanks
Want results from more Discord servers?
Add your server