🐛(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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user