chore: update fetching logic

This commit is contained in:
Aaryan Khandelwal 2024-05-11 18:20:07 +05:30
parent 17c539658b
commit 5c87e3510c

View File

@ -137,11 +137,14 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {
// } // }
}; };
const interval = setInterval(() => { // Fetch the description immediately
fetchDescription(); fetchDescription();
}, 15000);
return () => clearInterval(interval); // Then fetch the description every 10 seconds
const intervalId = setInterval(fetchDescription, 10000);
// Clear the interval when the component is unmounted
return () => clearInterval(intervalId);
}, [pageId, projectId, workspaceSlug]); }, [pageId, projectId, workspaceSlug]);
useEffect(() => { useEffect(() => {