diff --git a/app/work/[slug]/page.tsx b/app/work/[slug]/page.tsx index e6d49d7..e71e8c9 100644 --- a/app/work/[slug]/page.tsx +++ b/app/work/[slug]/page.tsx @@ -124,9 +124,8 @@ function Article({ slug }: { slug: string }) { const article = WORK_ARTICLES[slug]; if (!article) { return ( -
-
-
+ <> +

404 @@ -141,18 +140,20 @@ function Article({ slug }: { slug: string }) {

-
-
-
+ + ); } return ( -
-
-
+ <> + {/* The window (Lenis) is the scroller — the original nests its own + overflow container per route because its Lenis wraps
; our + Lenis is window-level, so a nested overflow div would swallow the + wheel and kill scrolling. */} +

{article.title} @@ -222,9 +223,8 @@ function Article({ slug }: { slug: string }) {

)} - -
- + + ); } diff --git a/components/canvas/HeroScene.tsx b/components/canvas/HeroScene.tsx index b9faf90..02befac 100644 --- a/components/canvas/HeroScene.tsx +++ b/components/canvas/HeroScene.tsx @@ -1,6 +1,7 @@ "use client"; import { useEffect, useRef } from "react"; +import { usePathname } from "next/navigation"; import { Canvas, useThree } from "@react-three/fiber"; import { PerspectiveCamera } from "@react-three/drei"; @@ -76,6 +77,13 @@ export function HeroScene() { const isMobile = useIsMobile(); const ready = useAppReady(); const hostRef = useRef(null); + // Original canvas lifecycle (module 34841 `canvas/set`): the canvas is + // mounted for the home page and the fullscreen transitions; on detail + // routes it is unmounted once the route reveal completes. Our DOM-based + // transition overlay covers navigation, so the canvas simply renders + // home-only — no background FX / stickers / models leak onto detail pages. + const pathname = usePathname(); + const home = pathname === "/"; // Watchdog (outside the Canvas so it runs even before R3F configures): // R3F's react-use-measure can capture a stale intrinsic-size measurement @@ -111,6 +119,8 @@ export function HeroScene() { }; }, []); + if (!home) return null; + return ( // 1:1 original stacking: z-auto fixed host BEFORE the grid/main in DOM. // The z-20 BackgroundGrid (rendered after this element) paints above the diff --git a/components/dom/LoadingOverlay.tsx b/components/dom/LoadingOverlay.tsx index 3780ee0..e9fbfa4 100644 --- a/components/dom/LoadingOverlay.tsx +++ b/components/dom/LoadingOverlay.tsx @@ -1,10 +1,7 @@ "use client"; -import { - useEffect, - useState, - useSyncExternalStore, -} from "react"; +import { useEffect, useState, useSyncExternalStore } from "react"; +import { usePathname } from "next/navigation"; import { loadingBus } from "@/lib/loadingBus"; import LoadingCurtain from "@/components/canvas/LoadingCurtain"; @@ -71,6 +68,9 @@ export function useAppReady(): boolean { export function LoadingOverlay() { const heavy = useHeavyLoad(); const fontsReady = useFontsReady(); + // Original useHomeLoadingGate: the entry curtain is a "/"-only flow — + // detail routes render with no loading curtain at all. + const pathname = usePathname(); // wait → fading → reveal → (unmount when reveal completes) const [phase, setPhase] = useState<"wait" | "fading" | "reveal">("wait"); @@ -92,7 +92,7 @@ export function LoadingOverlay() { return () => window.clearTimeout(t2); }, [phase]); - if (!mounted) return null; + if (!mounted || pathname !== "/") return null; return ( <> diff --git a/components/dom/SmoothScroller.tsx b/components/dom/SmoothScroller.tsx index 6cef6c5..bf4ae40 100644 --- a/components/dom/SmoothScroller.tsx +++ b/components/dom/SmoothScroller.tsx @@ -1,6 +1,7 @@ 'use client'; import { useEffect } from 'react'; +import { usePathname } from 'next/navigation'; import Lenis from 'lenis'; import { scrollBus, notifyScroll } from '@/lib/scrollBus'; import { scrollEnv } from '@/lib/scrollEnv'; @@ -21,7 +22,29 @@ const clamp01 = (v: number) => Math.min(1, Math.max(0, v)); * camera pull-back). */ export default function SmoothScroller() { + // Original route wiring (chunk 3c6cc5b2 module 95212): the home route is + // wrapped in ReactLenis; every other route scrolls its container + // natively. Our Lenis is window-level, so on detail routes we destroy it + // entirely (native window scroll) and reset the scroll to the top — the + // transition overlay covers the jump. + const pathname = usePathname(); + const isHome = pathname === '/'; + + // Scroll reset per route (original scrolls its per-route container to + // top on mount; the transition cover hides the jump). useEffect(() => { + if (window.location.hash) return; + window.scrollTo(0, 0); + requestAnimationFrame(() => window.scrollTo(0, 0)); + }, [isHome]); + + useEffect(() => { + if (!isHome) { + scrollEnv.setLenis(null); + return; + } + let disposed = false; + let rafId = 0; // Refresh must always start at the top (original behavior: no anchor // → scroll to 0; also re-asserted on bfcache pageshow). if ('scrollRestoration' in window.history) { @@ -73,19 +96,22 @@ export default function SmoothScroller() { updateCameraProgress(); function raf(time: number) { + if (disposed) return; lenis.raf(time); - requestAnimationFrame(raf); + rafId = requestAnimationFrame(raf); } - requestAnimationFrame(raf); + rafId = requestAnimationFrame(raf); return () => { + disposed = true; + cancelAnimationFrame(rafId); window.removeEventListener('resize', updateCameraProgress); window.removeEventListener('pageshow', onPageShow); scrollEnv.setLenis(null); lenis.destroy(); }; - }, []); + }, [isHome]); return null; }