Files
Portfolio/src/components/PageTransition.tsx
T
damjan_savicandClaude Opus 4.5 61c7c523ab Performance: Framer-motion aus kritischem Pfad entfernt
- Framer-motion aus Layout, NavLink, ContactInfo, LanguageSwitcher entfernt
- PageTransition komplett vereinfacht (keine 1200ms Verzögerung mehr)
- FloatingPaths wird erst nach 2s lazy geladen
- Framer-motion und lucide-react in separate Chunks getrennt
- Icons-Chunk: 10.87KB (statt 126KB ui-vendor)
- Animations-Chunk wird erst bei Bedarf geladen

Einsparung: ~115KB beim Initial Load

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 22:34:52 +01:00

26 lines
750 B
TypeScript

"use client"
import React, { useEffect, useRef } from "react"
import { useLocation } from "react-router-dom"
interface PageTransitionProps {
children: React.ReactNode
}
// Simplified page transition - no loading delay for better LCP
const PageTransition = ({ children }: PageTransitionProps) => {
const location = useLocation()
const previousPathRef = useRef<string | null>(null)
useEffect(() => {
// Only scroll on path change, not on initial mount
if (previousPathRef.current && location.pathname !== previousPathRef.current) {
window.scrollTo(0, 0)
}
previousPathRef.current = location.pathname
}, [location.pathname])
return <>{children}</>
}
export default PageTransition