From 5afb87c9cdcc5c98ce713adb69cfdfadf6f5d2e6 Mon Sep 17 00:00:00 2001 From: Stefan Hacker Date: Sun, 12 Apr 2026 11:21:10 +0200 Subject: [PATCH] fix: SSE-Reload in FilesView etwas robuster Beim Verbindungsaufbau (open-Event) wird jetzt ein initialer Reload ausgeloest, damit eventuelle Changes in der Zeit zwischen letzter Anzeige und SSE-Verbindung nicht verloren gehen. Gilt fuer eigene und freigegebene Ordner gleichermassen (selbe FilesView-Komponente). Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/views/FilesView.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/FilesView.vue b/frontend/src/views/FilesView.vue index c3deefa..dbec2ad 100644 --- a/frontend/src/views/FilesView.vue +++ b/frontend/src/views/FilesView.vue @@ -739,10 +739,13 @@ onMounted(() => { const url = `/api/sync/events?token=${encodeURIComponent(auth.accessToken)}` try { eventSource = new EventSource(url) - // Lock/unlock/create/update/delete all warrant a refresh of the list const handler = () => scheduleReload() + // Any named event from the server triggers a reload. Using onmessage + // alone misses typed events (event: file), so we wrap addEventListener + // into a tiny catch-all by hooking the generic EventSource dispatch. eventSource.addEventListener('file', handler) eventSource.addEventListener('message', handler) + eventSource.addEventListener('open', () => scheduleReload()) eventSource.onerror = () => { /* browser auto-reconnects */ } } catch { /* SSE not available - fall back to manual refresh */ } }