feat(streaming): add global activity watchers, client-side buffering, and improved real-time streaming UX

This commit is contained in:
2026-01-28 14:02:48 +00:00
parent ad8529cb0f
commit 8cc9a1850a
14 changed files with 630 additions and 146 deletions

View File

@@ -421,15 +421,18 @@ export class TsviewApp extends DeesElement {
async connectedCallback() {
super.connectedCallback();
await this.loadData();
// Initialize WebSocket connection for real-time updates
// Start WebSocket connection first (non-blocking) so it's in-flight
// before child components try to subscribe
this.initializeChangeStream();
await this.loadData();
}
private async initializeChangeStream() {
try {
await changeStreamService.connect();
console.log('[TsviewApp] ChangeStream connected');
// Subscribe to activity globally so events are buffered regardless of active tab
await changeStreamService.subscribeToActivity();
} catch (error) {
console.warn('[TsviewApp] Failed to connect to ChangeStream:', error);
}