Skip to content

perf: wave B — CLS fixes for home and gallery#45

Merged
Bissbert merged 1 commit into
mainfrom
feature/perf-wave-b
May 18, 2026
Merged

perf: wave B — CLS fixes for home and gallery#45
Bissbert merged 1 commit into
mainfrom
feature/perf-wave-b

Conversation

@Bissbert
Copy link
Copy Markdown
Contributor

Summary

  • HeroCrystal3D (src/components/crystal/HeroCrystal3D.tsx): SSR placeholder now reserves square aspect-ratio via style={{ aspectRatio: '1 / 1' }}, eliminating the layout shift when the Three.js Canvas mounts post-hydration. Target: home CLS < 0.1 (was 0.16).
  • FamilyCard (src/components/gallery/FamilyCard.tsx): <img> fallback given explicit width="568" height="568" matching the crystal SVG viewBox; browser reserves the slot before SVG bytes arrive. Target: gallery CLS < 0.1 (was 0.258).
  • index.astro (src/pages/index.astro): Two <SectionHeader client:load> React islands replaced with the static Astro variant (src/components/ui-astro/SectionHeader.astro), removing a no-op hydration step from the home critical path. Combined with wave A's HeroCrystal3D client:idle demotion, targets home mobile TBT < 200 ms (was 581 ms).

Part of audits/perf-2026-05/ remediation (wave B of the performance optimisation plan).

Test plan

  • npm run build passes with no type errors or warnings
  • npm run lint-and-check clean
  • Home page: no visible layout shift on load (Chrome DevTools CLS overlay)
  • Gallery page: image placeholders maintain correct dimensions before SVG load
  • Section headers render correctly on home page (no hydration flash)

- HeroCrystal3D: reserve square aspect-ratio on SSR placeholder so the
  post-hydration Three.js Canvas swap-in doesn't shift layout (target: home CLS < 0.1, was 0.16)
- FamilyCard: add explicit width/height="568" to the <img> SVG fallback
  matching the crystal SVG viewBox; browser now reserves space before
  the SVG byte stream lands (target: gallery CLS < 0.1, was 0.258)
- index.astro: replace the two SectionHeader React islands (client:load)
  with the existing Astro variant src/components/ui-astro/SectionHeader.astro;
  removes a no-op React hydration step from the home critical path
  (combined with wave A's HeroCrystal3D client:idle, this targets
  home mobile TBT < 200ms, was 581ms)

Part of audits/perf-2026-05/ remediation.
@github-actions
Copy link
Copy Markdown

🚀 Preview deployed to: https://5f4e3c61.gemmology-dev.pages.dev

@Bissbert Bissbert merged commit 51d5cca into main May 18, 2026
5 of 6 checks passed
@Bissbert Bissbert deleted the feature/perf-wave-b branch May 18, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant