-
Notifications
You must be signed in to change notification settings - Fork 93
🚀 Fix: Global Scroll Performance Optimization & FAQ Page UI Enhancement (#318) #321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -38,13 +38,39 @@ import CookiePolicy from "./pages/CookiePolicy"; | |||||||||||||||||||||||||||||||||||||||||||
| import ScrollToTopOnRouteChange from "./components/shared/ScrollToTopOnRouteChange"; | ||||||||||||||||||||||||||||||||||||||||||||
| import Navbar from "./components/Navbar"; | ||||||||||||||||||||||||||||||||||||||||||||
| import { useEffect } from "react"; | ||||||||||||||||||||||||||||||||||||||||||||
| import Lenis from "@studio-freight/lenis"; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| function App() { | ||||||||||||||||||||||||||||||||||||||||||||
| const location = useLocation(); | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| const hideFooterRoutes = ["/login", "/register"]; | ||||||||||||||||||||||||||||||||||||||||||||
| const hideFooter = hideFooterRoutes.includes(location.pathname); | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // Initialize smooth scrolling with Lenis | ||||||||||||||||||||||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||||||||||||||||||||||
| const lenis = new Lenis({ | ||||||||||||||||||||||||||||||||||||||||||||
| duration: 1.2, | ||||||||||||||||||||||||||||||||||||||||||||
| easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)), | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+49
to
+53
|
||||||||||||||||||||||||||||||||||||||||||||
| direction: "vertical", | ||||||||||||||||||||||||||||||||||||||||||||
| gestureDirection: "vertical", | ||||||||||||||||||||||||||||||||||||||||||||
| smooth: true, | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+54
to
+56
|
||||||||||||||||||||||||||||||||||||||||||||
| direction: "vertical", | |
| gestureDirection: "vertical", | |
| smooth: true, | |
| orientation: "vertical", | |
| gestureOrientation: "vertical", | |
| smoothWheel: true, |
Copilot
AI
Feb 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RAF loop isn’t cancellable. After unmount, requestAnimationFrame(raf) will keep running and may call lenis.raf after lenis.destroy(), causing leaks or errors. Store the RAF id (or use a running flag) and cancel/stop the loop in the cleanup.
| function raf(time) { | |
| lenis.raf(time); | |
| requestAnimationFrame(raf); | |
| } | |
| requestAnimationFrame(raf); | |
| return () => { | |
| let rafId; | |
| function raf(time) { | |
| lenis.raf(time); | |
| rafId = requestAnimationFrame(raf); | |
| } | |
| rafId = requestAnimationFrame(raf); | |
| return () => { | |
| if (rafId) { | |
| cancelAnimationFrame(rafId); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@studio-freight/lenisis marked deprecated in the lockfile; it has been renamed tolenis. Consider migrating the dependency/import tolenisto avoid relying on a deprecated package and to stay aligned with upstream docs/support.