From be22dde08f45cd1bf444b717727a759fa2f7c68f Mon Sep 17 00:00:00 2001 From: rene Date: Sun, 17 May 2026 16:50:17 +0200 Subject: [PATCH] =?UTF-8?q?Feature:=20PocketBase=20Realtime-Subscription?= =?UTF-8?q?=20=E2=80=94=20Dashboard=20aktualisiert=20sofort=20nach=20Speic?= =?UTF-8?q?hern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/routes/+page.svelte | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/routes/+page.svelte b/app/src/routes/+page.svelte index a85d765..0e80911 100644 --- a/app/src/routes/+page.svelte +++ b/app/src/routes/+page.svelte @@ -38,8 +38,21 @@ onMount(() => { if (!browser) return; fetchLiveData(); + + // Realtime: sofort aktualisieren wenn neuer Eintrag gespeichert wird + pb.collection('check_logs').subscribe('*', (e) => { + if (e.action === 'create' && e.record?.tenant === DEMO_TENANT) { + fetchLiveData(); + } + }); + + // Fallback-Polling alle 30s const iv = setInterval(fetchLiveData, 30_000); - return () => clearInterval(iv); + + return () => { + pb.collection('check_logs').unsubscribe('*'); + clearInterval(iv); + }; }); function formatTime(iso: string) {