Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix Space profile scroll flash on back navigation

Anand Baburajan202a43d3a196
diff --git a/web/apps/space/src/utils/route-transitions.tsx b/web/apps/space/src/utils/route-transitions.tsx
index 69d8ba47b8..be04e6eab6 100644
--- a/web/apps/space/src/utils/route-transitions.tsx
+++ b/web/apps/space/src/utils/route-transitions.tsx
@@ -290,6 +290,8 @@ export const useSpaceRouteTransitionPopState = () => {
asPathRef.current = router.asPath;
React.useEffect(() => {
+ const scrollRestoration = window.history.scrollRestoration;
+ window.history.scrollRestoration = "manual";
recordRouteReplace(routePath(router.asPath));
router.beforePopState((state) => {
@@ -314,6 +316,9 @@ export const useSpaceRouteTransitionPopState = () => {
return false;
});
- return () => router.beforePopState(() => true);
+ return () => {
+ window.history.scrollRestoration = scrollRestoration;
+ router.beforePopState(() => true);
+ };
}, [router]);
};