fix : use effect

This commit is contained in:
martin legrand
2025-04-18 18:47:41 +02:00
parent 0f09ef92dd
commit 26e5159c1d
2 changed files with 8 additions and 10 deletions
+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 {