🐛(frontend) fix skeleton blocked on main page

If navigating quickly between documents, the
skeleton of the document page can be blocked
on the main page.
This commit fixes this issue by reseting the skeleton
state when unmounting the document page.
This commit is contained in:
Anthony LC
2026-03-13 11:10:13 +01:00
parent a9d2517c7b
commit c3acfe45d2
@@ -157,11 +157,16 @@ const DocPage = ({ id }: DocProps) => {
setCurrentDoc(docQuery);
}, [docQuery, setCurrentDoc, isFetching]);
/**
* Reset state when unmounting the component to avoid
* showing stale data when navigating to another document
*/
useEffect(() => {
return () => {
setCurrentDoc(undefined);
setIsSkeletonVisible(false);
};
}, [setCurrentDoc]);
}, [setCurrentDoc, setIsSkeletonVisible]);
/**
* We add a broadcast task to reset the query cache