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
awcodes2w ago
Why do you think this is happening?
Matthew
MatthewOP2w 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
awcodes2w 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
MatthewOP2w 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
awcodes2w ago
I would look into jobs and listeners and how you can leverage them with reverb.
Matthew
MatthewOP2w ago
thanks
Want results from more Discord servers?
Add your server