import type { HomeSectionItemsResponse, ResolvedSection, ResolvedSectionLayout } from "@/api/types"; export function collectCachedHomeSections( layout: ResolvedSectionLayout[], readCachedSection: (sectionId: string) => HomeSectionItemsResponse | undefined, ): Map { const cachedSections = new Map(); layout.forEach((section) => { const cached = readCachedSection(section.id); if (!cached?.section) { return; } cachedSections.set(section.id, cached.section); }); return cachedSections; }