fix : use effect

This commit is contained in:
martin legrand committed 2025-04-18 18:47:41 +02:00
1 parent 0f09ef92dd
commit 26e5159c1d
2 files changed
+8 -10

No files matched your search

+7 -9
View File
@@ -14,15 +14,13 @@ function App() {
const messagesEndRef = useRef(null);
useEffect(() => {
if (!isLoading) {
const intervalId = setInterval(() => {
checkHealth();
fetchLatestAnswer();
fetchScreenshot();
}, 1500);
return () => clearInterval(intervalId);
}
}, [isLoading, messages]);
const intervalId = setInterval(() => {
checkHealth();
fetchLatestAnswer();
fetchScreenshot();
}, 1500);
return () => clearInterval(intervalId);
}, [messages]);
const checkHealth = async () => {
try {