From 8813ed391029ed7f73d865cbd70ef1ec2064fd97 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Mon, 15 Jun 2026 15:54:38 +0200 Subject: [PATCH] fix: enforce hero remounts on route change --- app/[locale]/[slug]/page.tsx | 2 +- app/[locale]/standorte/[slug]/page.tsx | 2 +- components/blocks/HeroSection.tsx | 4 ++++ components/blocks/HeroVideo.tsx | 6 +++++- components/blocks/InteractiveGermanyMap.tsx | 5 +++-- components/home/Hero.tsx | 4 +++- 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/[locale]/[slug]/page.tsx b/app/[locale]/[slug]/page.tsx index 6d54b0a6c..771f14707 100644 --- a/app/[locale]/[slug]/page.tsx +++ b/app/[locale]/[slug]/page.tsx @@ -186,7 +186,7 @@ export default async function Page(props: { params: Promise<{ locale: string; sl
{/* Generic Hero Section (only for standard pages) */} {!isFullBleed && ( -
+
diff --git a/app/[locale]/standorte/[slug]/page.tsx b/app/[locale]/standorte/[slug]/page.tsx index f02d93df6..936391ee5 100644 --- a/app/[locale]/standorte/[slug]/page.tsx +++ b/app/[locale]/standorte/[slug]/page.tsx @@ -65,7 +65,7 @@ export default async function StandortDetail(props: { params: Promise<{ locale: return (
{/* Generic Hero Section to match standard pages */} -
+
diff --git a/components/blocks/HeroSection.tsx b/components/blocks/HeroSection.tsx index 796f4d6ca..ffd231a5f 100644 --- a/components/blocks/HeroSection.tsx +++ b/components/blocks/HeroSection.tsx @@ -2,6 +2,7 @@ import React from 'react'; import Image from 'next/image'; +import { usePathname } from 'next/navigation'; import { motion } from 'framer-motion'; import { Badge, Container, Heading } from '@/components/ui'; import { Button } from '@/components/ui/Button'; @@ -39,6 +40,7 @@ const itemVariants = { export const HeroSection: React.FC = (props) => { const { title, badge, subtitle, backgroundImage, alignment, ctaLabel, ctaHref } = props; const bgSrc = backgroundImage?.sizes?.card?.url || backgroundImage?.url; + const pathname = usePathname(); return (
= (props) => { > {bgSrc && ( = (props) => { )} ) : ( {posterAlt} (null); const router = useRouter(); + const pathname = usePathname(); const locale = useLocale(); const t = useTranslations('InteractiveGermanyMap'); const tStandard = useTranslations('StandardPage'); @@ -57,7 +58,7 @@ export function InteractiveGermanyMap({ const minorNodes = locations.filter((l) => l.type === 'minor_node'); return ( -
+
{/* Animated Border Glow */} {!isHero && } diff --git a/components/home/Hero.tsx b/components/home/Hero.tsx index 7421a64ac..27aab976a 100644 --- a/components/home/Hero.tsx +++ b/components/home/Hero.tsx @@ -8,6 +8,7 @@ import { useAnalytics } from '../analytics/useAnalytics'; import { AnalyticsEvents } from '../analytics/analytics-events'; import { useState, useEffect, useRef, useCallback } from 'react'; import { ChevronRight } from 'lucide-react'; +import { usePathname } from 'next/navigation'; import { AISearchResults } from '../search/AISearchResults'; const HeroIllustration = dynamic(() => import('./HeroIllustration'), { ssr: false }); const AIOrb = dynamic(() => import('../search/AIOrb'), { ssr: false }); @@ -15,6 +16,7 @@ const AIOrb = dynamic(() => import('../search/AIOrb'), { ssr: false }); export default function Hero({ data }: { data?: any }) { const t = useTranslations('Home.hero'); const locale = useLocale(); + const pathname = usePathname(); const { trackEvent } = useAnalytics(); const [searchQuery, setSearchQuery] = useState(''); @@ -85,7 +87,7 @@ export default function Hero({ data }: { data?: any }) { return ( <> -
+