Prevent multiple deploymentFinished event dispatches

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 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai 2025-12-11 09:25:22 +01:00
parent d9762e0310
commit 56102f6321

View file

@ -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');
}
}