Skip to content

Commit d2b760a

Browse files
fix: remove Suspense wrapper from hero splash logo to prevent CLS
The LazyBrandContextMenu Suspense boundary caused layout shift on page load as the fallback div swapped to the loaded component. Since both rendered the same images, replace with direct rendering.
1 parent e71479b commit d2b760a

1 file changed

Lines changed: 20 additions & 55 deletions

File tree

src/routes/index.tsx

Lines changed: 20 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ import LibraryCard from '~/components/LibraryCard'
2828
import { FeaturedShowcases } from '~/components/ShowcaseSection'
2929
import { Button } from '~/ui'
3030

31-
const LazyBrandContextMenu = React.lazy(() =>
32-
import('~/components/BrandContextMenu').then((m) => ({
33-
default: m.BrandContextMenu,
34-
})),
35-
)
36-
3731
export const textColors = [
3832
`text-rose-500`,
3933
`text-yellow-500`,
@@ -127,55 +121,26 @@ function Index() {
127121
/>
128122
</Link>
129123
</ClientOnly>
130-
<React.Suspense
131-
fallback={
132-
<div className="cursor-pointer relative z-10">
133-
<NetlifyImage
134-
src="/images/logos/splash-light.png"
135-
width={500}
136-
height={500}
137-
quality={85}
138-
className="w-[300px] pt-8 xl:pt-0 xl:w-[400px] 2xl:w-[500px] dark:hidden"
139-
alt="TanStack Logo"
140-
loading="eager"
141-
fetchPriority="high"
142-
/>
143-
<NetlifyImage
144-
src="/images/logos/splash-dark.png"
145-
width={500}
146-
height={500}
147-
quality={85}
148-
className="w-[300px] pt-8 xl:pt-0 xl:w-[400px] 2xl:w-[500px] hidden dark:block"
149-
alt="TanStack Logo"
150-
loading="eager"
151-
fetchPriority="high"
152-
/>
153-
</div>
154-
}
155-
>
156-
<LazyBrandContextMenu className="cursor-pointer relative z-10">
157-
<NetlifyImage
158-
src="/images/logos/splash-light.png"
159-
width={500}
160-
height={500}
161-
quality={85}
162-
className="w-[300px] pt-8 xl:pt-0 xl:w-[400px] 2xl:w-[500px] dark:hidden"
163-
alt="TanStack Logo"
164-
loading="eager"
165-
fetchPriority="high"
166-
/>
167-
<NetlifyImage
168-
src="/images/logos/splash-dark.png"
169-
width={500}
170-
height={500}
171-
quality={85}
172-
className="w-[300px] pt-8 xl:pt-0 xl:w-[400px] 2xl:w-[500px] hidden dark:block"
173-
alt="TanStack Logo"
174-
loading="eager"
175-
fetchPriority="high"
176-
/>
177-
</LazyBrandContextMenu>
178-
</React.Suspense>
124+
<NetlifyImage
125+
src="/images/logos/splash-light.png"
126+
width={500}
127+
height={500}
128+
quality={85}
129+
className="w-[300px] pt-8 xl:pt-0 xl:w-[400px] 2xl:w-[500px] dark:hidden"
130+
alt="TanStack Logo"
131+
loading="eager"
132+
fetchPriority="high"
133+
/>
134+
<NetlifyImage
135+
src="/images/logos/splash-dark.png"
136+
width={500}
137+
height={500}
138+
quality={85}
139+
className="w-[300px] pt-8 xl:pt-0 xl:w-[400px] 2xl:w-[500px] hidden dark:block"
140+
alt="TanStack Logo"
141+
loading="eager"
142+
fetchPriority="high"
143+
/>
179144
</div>
180145
<div className="flex flex-col items-center gap-6 text-center px-4 xl:text-left xl:items-start">
181146
<div className="flex gap-2 lg:gap-4 items-center">

0 commit comments

Comments
 (0)