Hero: keep the plain HTML region after hydration, add the slider around it

Replacing the region at hydration made new nodes (a late LCP candidate). The first photo, the title and the buttons now stay; the other slides, arrows and controls are added on top.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 17:39:06 +01:00
co-authored by Claude Sonnet 5.5
parent 1a59fc3125
commit 3d7bb2d4a6
4 changed files with 146 additions and 185 deletions
+9 -2
View File
@@ -18,7 +18,7 @@ const TIMEOUT_MS = 8000;
export default function useHero(
baked: HeroData,
load: LoadJson = loadFromApi,
): HeroData {
): { hero: HeroData; regionHero: HeroData } {
const hydrated = useHydrated();
const fromBlock = useMemo(() => {
const block = hydrated ? hostCmsData(document) : null;
@@ -45,5 +45,12 @@ export default function useHero(
};
}, [load]);
return fromBlock ?? fetched ?? baked;
// regionHero is what the plain HTML region of the page holds: the baked
// hero, or the one the API gave. The block of the host does not count: the
// host wrote that region itself and it must not be written over (that
// would replace the photo the browser has painted).
return {
hero: fromBlock ?? fetched ?? baked,
regionHero: fetched ?? baked,
};
}