Narrow IntersectionObserverrootMargin to use on pages that are NOT a single-dashboard "deep link" (/dashboards/<slug>.html, /politician-dashboard*.html). Multi-section pages such as index*.html have several below-the-fold sections โ #coalition-status typically sits 600โ1400 px below the fold โ and the 2000 px DEFAULT_ROOT_MARGIN would pre-fetch them eagerly, defeating the entire point of lazy loading.
The previous behaviour caused the homepage to download view_riksdagen_politician_experience_summary_sample.csv (โ 5.8 MiB) and view_riksdagen_politician_sample.csv (โ 542 KiB) on initial render via coalition-loader, driving Lighthouse Performance to 4 (LCP 5.3 s, TBT 5,330 ms). A 300 px margin still pre-fetches a touch before the section scrolls into view (smooth UX) without forcing the download on page load.
Tests assert this exact value to lock the contract.
Narrow
IntersectionObserverrootMarginto use on pages that are NOT a single-dashboard "deep link" (/dashboards/<slug>.html,/politician-dashboard*.html). Multi-section pages such asindex*.htmlhave several below-the-fold sections โ#coalition-statustypically sits 600โ1400 px below the fold โ and the 2000 px DEFAULT_ROOT_MARGIN would pre-fetch them eagerly, defeating the entire point of lazy loading.The previous behaviour caused the homepage to download
view_riksdagen_politician_experience_summary_sample.csv(โ 5.8 MiB) andview_riksdagen_politician_sample.csv(โ 542 KiB) on initial render viacoalition-loader, driving Lighthouse Performance to 4 (LCP 5.3 s, TBT 5,330 ms). A 300 px margin still pre-fetches a touch before the section scrolls into view (smooth UX) without forcing the download on page load.Tests assert this exact value to lock the contract.