From c738001f9a6f999c278dcf866ba9ca788fe42c18 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Tue, 30 Jun 2026 10:09:45 +0200 Subject: [PATCH] perf: eliminate feedback widget chunk via dead-code elimination --- app/[locale]/layout.tsx | 2 +- components/FeedbackClientWrapper.tsx | 18 +++++++++--------- components/blocks/ReferencesSlider.tsx | 13 ------------- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx index 490509e33..48f588632 100644 --- a/app/[locale]/layout.tsx +++ b/app/[locale]/layout.tsx @@ -209,7 +209,7 @@ export default async function Layout(props: { - {feedbackEnabled && } + diff --git a/components/FeedbackClientWrapper.tsx b/components/FeedbackClientWrapper.tsx index b4113ad81..62c2dad7f 100644 --- a/components/FeedbackClientWrapper.tsx +++ b/components/FeedbackClientWrapper.tsx @@ -2,17 +2,17 @@ import dynamic from 'next/dynamic'; -const FeedbackOverlay = dynamic( - () => import('@mintel/next-feedback/FeedbackOverlay').then((mod) => mod.FeedbackOverlay), - { ssr: false }, -); +const IS_ENABLED = process.env.NEXT_PUBLIC_FEEDBACK_ENABLED === 'true'; -interface FeedbackClientWrapperProps { - feedbackEnabled: boolean; -} +const FeedbackOverlay = IS_ENABLED + ? dynamic( + () => import('@mintel/next-feedback/FeedbackOverlay').then((mod) => mod.FeedbackOverlay), + { ssr: false }, + ) + : () => null; -export default function FeedbackClientWrapper({ feedbackEnabled }: FeedbackClientWrapperProps) { - if (!feedbackEnabled) return null; +export default function FeedbackClientWrapper() { + if (!IS_ENABLED) return null; return ; } diff --git a/components/blocks/ReferencesSlider.tsx b/components/blocks/ReferencesSlider.tsx index 34ac88e5e..1a450bd5c 100644 --- a/components/blocks/ReferencesSlider.tsx +++ b/components/blocks/ReferencesSlider.tsx @@ -47,19 +47,6 @@ export function ReferencesSlider(props: ReferencesSliderProps) { const isDraggingRef = React.useRef(false); const [isDragging, setIsDragging] = React.useState(false); - // Center the first card on mount so it appears in the middle with peek on both sides - React.useEffect(() => { - const el = containerRef.current; - if (!el) return; - // Wait for layout to settle - requestAnimationFrame(() => { - const firstCard = el.querySelector('[data-card]') as HTMLElement | null; - if (!firstCard) return; - const cardCenter = firstCard.offsetLeft + firstCard.offsetWidth / 2; - const containerCenter = el.offsetWidth / 2; - el.scrollLeft = cardCenter - containerCenter; - }); - }, [references.length]); const badge = props.badge || data?.badge || t('badge'); const title = props.title || data?.title || t('title');