Paginate beta history and refresh pages from events

This commit is contained in:
2026-10-06 14:50:47 -04:00
parent daefb22be6
commit d99e5979fa
13 changed files with 239 additions and 35 deletions
+5
View File
@@ -26,6 +26,11 @@ function updateDeployment(id: string, mutate: (d: PipelineDeployment) => void):
export function startPipelineStream(): (() => void) | undefined {
if (!browser || source) return;
source = new EventSource('/api/events/pipeline');
source.addEventListener('open', () => window.dispatchEvent(new Event('ec:pipeline-connected')));
source.addEventListener('beta-changed', event => {
try { window.dispatchEvent(new CustomEvent('ec:beta-changed', { detail: JSON.parse((event as MessageEvent).data) })); }
catch { /* Reconnect refreshes authoritative state if an event is malformed. */ }
});
for (const event of ['server-changed', 'server-state', 'deployment-opened', 'fleet-invalidated']) {
source.addEventListener(event, () => window.dispatchEvent(new Event('ec:fleet-changed')));
}