From 56102f6321403ad1014ce2043afa5f6a032c7091 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Thu, 11 Dec 2025 09:25:22 +0100 Subject: [PATCH] Prevent multiple deploymentFinished event dispatches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add flag to ensure event is only dispatched once, avoiding wasteful duplicate dispatches during the race condition window before Livewire removes wire:poll from the DOM. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/Livewire/Project/Application/Deployment/Show.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Livewire/Project/Application/Deployment/Show.php b/app/Livewire/Project/Application/Deployment/Show.php index 6d50fb3c7..44ab419c2 100644 --- a/app/Livewire/Project/Application/Deployment/Show.php +++ b/app/Livewire/Project/Application/Deployment/Show.php @@ -20,6 +20,8 @@ class Show extends Component public bool $is_debug_enabled = false; + private bool $deploymentFinishedDispatched = false; + public function getListeners() { return [ @@ -92,8 +94,9 @@ public function polling() $this->horizon_job_status = $this->application_deployment_queue->getHorizonJobStatus(); $this->isKeepAliveOn(); - // Dispatch event when deployment finishes to stop auto-scroll - if (! $this->isKeepAliveOn) { + // Dispatch event when deployment finishes to stop auto-scroll (only once) + if (! $this->isKeepAliveOn && ! $this->deploymentFinishedDispatched) { + $this->deploymentFinishedDispatched = true; $this->dispatch('deploymentFinished'); } }