1 parent 2d101d4 commit 8dd349bCopy full SHA for 8dd349b
1 file changed
src/client/components/cardgroup.jsx
@@ -90,8 +90,23 @@ export default function CardGroup({
90
};
91
window.addEventListener('focus', handleFocus);
92
93
+ // Refresh progress when component becomes visible (user navigates back to dashboard)
94
+ const handleVisibilityChange = () => {
95
+ if (!document.hidden) {
96
+ fetchProgress();
97
+ }
98
+ };
99
+ document.addEventListener('visibilitychange', handleVisibilityChange);
100
+
101
+ // Refresh progress periodically (every 5 seconds) when on dashboard
102
+ const interval = setInterval(() => {
103
104
+ }, 5000);
105
106
return () => {
107
window.removeEventListener('focus', handleFocus);
108
+ document.removeEventListener('visibilitychange', handleVisibilityChange);
109
+ clearInterval(interval);
110
111
}, [isAuthenticated, topicKey]);
112
0 commit comments