mirror of
https://github.com/coollabsio/coolify.git
synced 2026-10-29 01:54:37 +08: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>
21 lines
1.1 KiB
PHP
21 lines
1.1 KiB
PHP
<?php
|
|
|
|
it('refreshes backup executions from backup broadcasts on the current team channel', function () {
|
|
$serviceExecutions = file_get_contents(app_path('Livewire/Project/Service/BackupExecutions.php'));
|
|
$serviceBackups = file_get_contents(app_path('Livewire/Project/Service/VolumeBackup/Index.php'));
|
|
$databaseExecutions = file_get_contents(app_path('Livewire/Project/Database/BackupExecutions.php'));
|
|
$databaseBackupJob = file_get_contents(app_path('Jobs/DatabaseBackupJob.php'));
|
|
|
|
expect($serviceExecutions)
|
|
->toContain('teamChannelListeners([')
|
|
->toContain("'BackupCreated' => '\$refresh'")
|
|
->and($serviceBackups)
|
|
->toContain('teamChannelListeners([')
|
|
->toContain("'BackupCreated' => '\$refresh'")
|
|
->and($databaseExecutions)
|
|
->toContain("'BackupCreated' => 'refreshBackupExecutions'")
|
|
->not->toContain('$userId = Auth::id()')
|
|
->and(strpos($databaseBackupJob, "'finished_at' => Carbon::now()->toImmutable()"))
|
|
->toBeLessThan(strrpos($databaseBackupJob, 'BackupCreated::dispatch($this->team->id)'));
|
|
});
|