{useHero(heroContent, load).title}
; + return{useHero(heroContent, load).hero.title}
; } const block = (data: unknown) => { diff --git a/web/src/components/Hero/useHero.ts b/web/src/components/Hero/useHero.ts index cd81dcc..8132dc0 100644 --- a/web/src/components/Hero/useHero.ts +++ b/web/src/components/Hero/useHero.ts @@ -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, + }; }