gpt-engineer-app[bot] 1 неделя назад
Родитель
Сommit
99cef1cccf
1 измененных файлов с 16 добавлено и 0 удалено
  1. 16 0
      src/pages/Index.tsx

+ 16 - 0
src/pages/Index.tsx

@@ -115,6 +115,22 @@ const Index = () => {
       document.title = baseTitle;
       document.title = baseTitle;
     }
     }
   }, [unreadCount]);
   }, [unreadCount]);
+
+  // Auto-refresh articles every 5 minutes, paused when article modal is open
+  const REFRESH_INTERVAL = 5 * 60 * 1000; // 5 minutes
+  useEffect(() => {
+    if (isArticleModalOpen) {
+      return;
+    }
+
+    const intervalId = setInterval(() => {
+      refetch();
+    }, REFRESH_INTERVAL);
+
+    return () => {
+      clearInterval(intervalId);
+    };
+  }, [isArticleModalOpen, refetch]);
   const handleRefresh = () => {
   const handleRefresh = () => {
     refetch();
     refetch();
     toast.success("Flux actualisés");
     toast.success("Flux actualisés");