Skip to content

Commit 72c81d6

Browse files
committed
solved autoscroll problem
1 parent 15bd126 commit 72c81d6

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎client/src/routes/index.tsx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ function Landing() {
116116
const heroOpacity = useTransform(scrollYProgress, [0, 1], [1, 0.3]);
117117

118118
useEffect(() => {
119+
// Always start at top — prevents scrollRestoration from causing double-scroll
120+
window.scrollTo(0, 0);
121+
119122
// Staggered Page-Load Hero Timeline
120123
const tl = gsap.timeline({ defaults: { ease: "power4.out" } });
121124

@@ -154,6 +157,11 @@ function Landing() {
154157
{ opacity: 1, scale: 1, rotateX: 0, duration: 1.2, ease: "power3.out" },
155158
"-=0.6",
156159
);
160+
161+
// Cleanup: kill timeline on unmount (fixes React StrictMode double-invocation)
162+
return () => {
163+
tl.kill();
164+
};
157165
}, []);
158166

159167
return (

0 commit comments

Comments
 (0)