feat(streaming): add global activity watchers, client-side buffering, and improved real-time streaming UX
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user