feat(shared-schedule): implement polling for real-time sync of taken doses

This commit is contained in:
Daniel Volz
2025-12-26 21:58:16 +01:00
parent 7e51b4c806
commit 551c0b4db5
+9 -1
View File
@@ -256,6 +256,10 @@ function AppContent() {
}
}
loadTakenDoses();
// Poll for updates every 5 seconds (real-time sync with share links)
const interval = setInterval(loadTakenDoses, 5000);
return () => clearInterval(interval);
}
}, [user?.id]);
@@ -2349,7 +2353,7 @@ function SharedSchedule() {
return () => window.removeEventListener("keydown", handleKeyDown);
}, [lightboxImage]);
// Load taken doses from server
// Load taken doses from server with polling for real-time sync
useEffect(() => {
if (token) {
async function loadTakenDoses() {
@@ -2366,6 +2370,10 @@ function SharedSchedule() {
}
}
loadTakenDoses();
// Poll for updates every 5 seconds (real-time sync with dashboard)
const interval = setInterval(loadTakenDoses, 5000);
return () => clearInterval(interval);
}
}, [token]);