mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-14 16:52:45 -04:00
Livewire rebuilds listener names from the session team on every event call. After a team switch in another tab, open pages still listen on the old team channel, so events failed with EventHandlerDoesNotExist (500), or ran handlers that load resources scoped to the new team (404). Store the team at mount and build team channel listeners from it. Events for a team that is no longer the session team are ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1015 B
PHP
40 lines
1015 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Project\Application;
|
|
|
|
use App\Models\Application;
|
|
use App\Traits\ListensToTeamChannel;
|
|
use Illuminate\Contracts\View\View;
|
|
use Livewire\Component;
|
|
|
|
class Status extends Component
|
|
{
|
|
use ListensToTeamChannel;
|
|
|
|
public Application $application;
|
|
|
|
public function getListeners(): array
|
|
{
|
|
return $this->teamChannelListeners([
|
|
'ServiceStatusChanged' => 'refreshStatus',
|
|
'ServiceChecked' => 'refreshStatus',
|
|
]);
|
|
}
|
|
|
|
public function refreshStatus(): void
|
|
{
|
|
$this->application->refresh();
|
|
}
|
|
|
|
public function render(): View
|
|
{
|
|
return view('livewire.project.application.status', [
|
|
'healthcheckUrl' => route('project.application.healthcheck', [
|
|
'project_uuid' => $this->application->project()->uuid,
|
|
'environment_uuid' => $this->application->environment->uuid,
|
|
'application_uuid' => $this->application->uuid,
|
|
]),
|
|
]);
|
|
}
|
|
}
|