Revert "refactor sticky scroll handler"

This reverts commit da9d7f8eb3.
This commit is contained in:
2025-10-09 00:20:39 +03:00
parent 5a9973d5b3
commit dea9a59127
4 changed files with 78 additions and 214 deletions

View File

@@ -27,29 +27,11 @@ export const ScrollToTop: React.FC = () => {
const { pathname } = useLocation();
useEffect(() => {
// Use a more stable approach to find the scroll container
const findScrollContainer = () => {
const antApp = document.querySelector('.ant-app') as HTMLElement;
if (antApp && antApp.scrollHeight > antApp.clientHeight) {
return antApp;
}
const appContainer = document.querySelector('[class*="App"]') as HTMLElement;
if (appContainer && appContainer.scrollHeight > appContainer.clientHeight) {
return appContainer;
}
return document.documentElement;
};
const scrollContainer = findScrollContainer();
if (scrollContainer) {
scrollContainer.scrollTo({
top: 0,
left: 0,
behavior: "smooth",
}); // Scroll to the top when the location changes
}
window.scrollTo({
top: 0,
left: 0,
behavior: "smooth",
}); // Scroll to the top when the location changes
}, [pathname]);
return null; // This component doesn't render anything