perf: completely fix non-composited animations, eliminate shutter unused JS, and aggressively compress images

This commit is contained in:
2026-07-02 10:29:31 +02:00
parent be3b2e6a7b
commit 2c162f5314
6 changed files with 13 additions and 19 deletions

View File

@@ -27,14 +27,8 @@ export function TransitionProvider({ children }: { children: ReactNode }) {
const [hasMountedShutter, setHasMountedShutter] = useState(false);
const router = useRouter();
// Load the heavy shutter chunk in the background when the main thread is idle
useEffect(() => {
if (typeof window !== 'undefined' && 'requestIdleCallback' in window) {
window.requestIdleCallback(() => setHasMountedShutter(true));
} else {
setTimeout(() => setHasMountedShutter(true), 2000);
}
}, []);
// We no longer eagerly load the shutter in the background.
// It will be loaded precisely when the user initiates a transition.
// We use a ref to track transition state without triggering the route change effect when it turns true
const isTransitioningRef = React.useRef(isTransitioning);