mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 17:42:34 +00: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>
39 lines
959 B
PHP
39 lines
959 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Project\Database;
|
|
|
|
use App\Traits\ListensToTeamChannel;
|
|
use Illuminate\Contracts\View\View;
|
|
use Livewire\Component;
|
|
|
|
class Status extends Component
|
|
{
|
|
use ListensToTeamChannel;
|
|
|
|
public $database;
|
|
|
|
public function getListeners(): array
|
|
{
|
|
return $this->teamChannelListeners([
|
|
'ServiceStatusChanged' => 'refreshStatus',
|
|
'ServiceChecked' => 'refreshStatus',
|
|
]);
|
|
}
|
|
|
|
public function refreshStatus(): void
|
|
{
|
|
$this->database->refresh();
|
|
}
|
|
|
|
public function render(): View
|
|
{
|
|
return view('livewire.project.database.status', [
|
|
'healthcheckUrl' => route('project.database.healthcheck', [
|
|
'project_uuid' => $this->database->environment->project->uuid,
|
|
'environment_uuid' => $this->database->environment->uuid,
|
|
'database_uuid' => $this->database->uuid,
|
|
]),
|
|
]);
|
|
}
|
|
}
|