Files
news-platform/frontend/src
miguel-teixeira ee8405980c
Tests / bridge tests (push) Successful in 40s
Tests / writer-pipeline tests (push) Successful in 50s
Tests / frontend lib tests (push) Successful in 1m42s
Tests / writer-pipeline tests (pull_request) Successful in 1m21s
Tests / bridge tests (pull_request) Successful in 1m23s
Tests / frontend lib tests (pull_request) Successful in 48s
fix(perf): article TBT 7416ms — strip scripts/styles/iframes/event-handlers, lazy-load images, content-visibility
BIT-28145: newsproject.bitreport.pt article template Total Blocking Time
was 7416ms (Lighthouse Performance 60) vs home 73ms (Performance 97).

Root cause: WordPress oEmbed HTML injected via set:html rendered <script>,
<style>, <link> tags, inline event handlers, and heavy <iframe> embeds
(Twitter, Instagram, YouTube) that blocked the main thread during HTML
parsing. The prior sanitizer only stripped <script> tags and added
loading=lazy to iframes — insufficient for the oEmbed payload.

Changes:
- Enhance bridge and frontend sanitizers to strip <style>, <link>,
  and inline event handlers (on* attributes) in addition to <script>
- Replace <iframe> elements with click-to-load placeholders (eliminates
  iframe document parsing cost from main thread)
- Add loading=lazy + decoding=async to <img> tags in article body
- Add content-visibility:auto to .article-body CSS (skip off-screen render)
- Add embed-placeholder styles in global.css + click handler in [slug].astro
- Parallelize article/related/trending bridge fetches
- Add preconnect hints for gravatar and featured images
- Document root cause in PERFORMANCE_BASELINE.md

Paperclip-Agent: Miguel Teixeira (urlKey miguel-teixeira; id 0f722e1a-bc3e-4381-8d98-76fa3c7aea10)
Paperclip-Issue: BIT-28145
2026-08-04 21:57:16 +01:00
..