Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Fix restart initiated duplicate and restore activity logs

Andras Bacsaic42fb8134704
diff --git a/app/Jobs/RestartProxyJob.php b/app/Jobs/RestartProxyJob.php
index f4554519f1..96c66ccdea 100644
--- a/app/Jobs/RestartProxyJob.php
+++ b/app/Jobs/RestartProxyJob.php
@@ -46,9 +46,11 @@ class RestartProxyJob implements ShouldBeEncrypted, ShouldQueue
// listener that handles UI updates and Traefik version checks
$activity = StartProxy::run($this->server, force: true, restarting: true);
- // Store activity ID for reference
+ // Store activity ID and dispatch event with it so UI can open activity monitor
if ($activity && is_object($activity)) {
$this->activity_id = $activity->id;
+ // Dispatch event with activity ID so the UI can show logs
+ ProxyStatusChangedUI::dispatch($this->server->team_id, $this->activity_id);
}
} catch (\Throwable $e) {
diff --git a/app/Livewire/Server/Navbar.php b/app/Livewire/Server/Navbar.php
index f630f08134..17c30e0f8b 100644
--- a/app/Livewire/Server/Navbar.php
+++ b/app/Livewire/Server/Navbar.php
@@ -30,6 +30,8 @@ class Navbar extends Component
public ?string $lastNotifiedStatus = null;
+ public bool $restartInitiated = false;
+
public function getListeners()
{
$teamId = auth()->user()->currentTeam()->id;
@@ -65,11 +67,22 @@ class Navbar extends Component
try {
$this->authorize('manageProxy', $this->server);
+ // Prevent duplicate restart messages (e.g., from double-click or re-render)
+ if ($this->restartInitiated) {
+ return;
+ }
+ $this->restartInitiated = true;
+
// Always use background job for all servers
RestartProxyJob::dispatch($this->server);
- $this->dispatch('info', 'Proxy restart initiated. Monitor progress in activity logs.');
+ $this->dispatch('info', 'Proxy restart initiated.');
+
+ // Reset the flag after a short delay to allow future restarts
+ $this->restartInitiated = false;
} catch (\Throwable $e) {
+ $this->restartInitiated = false;
+
return handleError($e, $this);
}
}