- - § {entry.data.usc_section}. {entry.data.title.replace(/^Section \S+ - /, '')} - -
-+ + § {entry.data.usc_section}. {entry.data.title.replace(/^Section \S+ - /, '')} + +
+- Loading full chapter text… -
- )} +diff --git a/apps/web/src/pages/browse/[title]/[chapter].astro b/apps/web/src/pages/browse/[title]/[chapter].astro index 12ecc6a..40b2616 100644 --- a/apps/web/src/pages/browse/[title]/[chapter].astro +++ b/apps/web/src/pages/browse/[title]/[chapter].astro @@ -51,20 +51,17 @@ const sectionMeta = sortedSections.map((entry) => { return { entry, isInactive, statusLabel }; }); -// Only render full content at build time for small chapters (≤50 sections) -// Large chapters render on-demand via the toggle +// Statically compile all section bodies into the chapter rollup at build time +const renderedSections = await Promise.all( + sectionMeta.map(async ({ entry, isInactive, statusLabel }) => { + const { Content } = await render(entry); + return { entry, Content, isInactive, statusLabel }; + }) +); + const INLINE_THRESHOLD = 50; const isSmallChapter = sortedSections.length <= INLINE_THRESHOLD; -const renderedSections = isSmallChapter - ? await Promise.all( - sectionMeta.map(async ({ entry, isInactive, statusLabel }) => { - const { Content } = await render(entry); - return { entry, Content, isInactive, statusLabel }; - }) - ) - : []; - const base = import.meta.env.BASE_URL; const activeCount = sectionMeta.filter(s => !s.isInactive).length; --- @@ -135,42 +132,36 @@ const activeCount = sectionMeta.filter(s => !s.isInactive).length; - +
- Loading full chapter text… -
- )} +