Skip to content

Perfformance: Lazy-load editor images#212

Merged
priethor merged 1 commit into
mainfrom
perf-lazy-loading
May 19, 2026
Merged

Perfformance: Lazy-load editor images#212
priethor merged 1 commit into
mainfrom
perf-lazy-loading

Conversation

@priethor

@priethor priethor commented May 19, 2026

Copy link
Copy Markdown
Collaborator

What

Add loading="lazy" and decoding="async" to three <img> tags in the editor shell:

  • The cover image in the document-cover block
  • The image variant of PageIcon (sidebar and command palette)
  • The featured-image preview in PageInspectorSidebar

Why

None of these are on screen at first render, so the browser doesn't need to fetch or decode them eagerly. decoding="async" also lets the decode work happen off the main thread.

WordPress core sets the same attributes on the public frontend via wp_get_attachment_image(). This brings the editor's own <img> tags in line.

Test plan

  • Open a document with a cover and a featured image; reload with the Network tab open.
  • Off-screen images should load only after scrolling them into view.
  • No visible layout shift.

Add loading="lazy" and decoding="async" to the three off-screen images we
render in the shell: the document cover, the page icon, and the featured
image preview in the inspector. None of these are above the fold in their
typical context, so deferring fetch and decoding shaves work off the
initial render without changing layout.
@github-actions

Copy link
Copy Markdown

Performance vs main

Workload changed in 2 scenarios. 6 scenarios with notable timing changes.

Scenario Workload Timing
Open rows page 50 - p50 -22.6%
Load rows with heavy rollups - p50 -17.2%
Open a row detail (resolve and hydrate) - Resolve p50 +20.4%
Paginate to rollups - rows API -20.4%
Open page in editor +1 REST request -
Open command palette - ready -17.6%
Open workspace home +1 REST request -
Navigate to next row - long tasks -34.3%

Full numbers in the job summary.

@priethor priethor changed the title Lazy-load editor images Perfformance: Lazy-load editor images May 19, 2026
@priethor priethor merged commit 7dc049f into main May 19, 2026
11 checks passed
@priethor priethor deleted the perf-lazy-loading branch May 19, 2026 11:17
@priethor priethor added this to the 0.1.0 milestone May 28, 2026
@priethor priethor added type: enhancement Improvement to existing behavior. area: performance Performance budgets, profiling, benchmarks, and regressions. labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: performance Performance budgets, profiling, benchmarks, and regressions. type: enhancement Improvement to existing behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant