Skip to content

Media Thumbnail Field: Optimise loading of the thumbnail imageΒ #75406

@andrewserong

Description

@andrewserong

Part of:

While testing the new infinite scroll work for DataViews with the experimental media modal (#74378), I noticed some performance issues with loading in the media thumbnails while scrolling up and down the media library.

There are some performance improvements we could do to help here:

  • Avoid using the full source_url where possible (i.e. max out at a large size)
  • Explore asynchronously / lazy loading the images via JS for smoother pop in / fade out of the media thumbnails

To reproduce the issue:

  • With a media library with lots of images
  • Activate the media modal experiment in Gutenberg settings, and fire up Improvements to dataviews infinite scrollΒ #74378 to try out the infinite scroll
  • Adjust the Grid settings in the modal to have a really small preview (so that each "page" of the scrolling loads in lots of images at once)
  • Scroll down (or up and down) really fast, and note that things lock up a little bit rather than loading in smoothly
  • If you're not noticing this, maybe try some CPU or network throttling to see if you can replicate (I'm testing on a MacBook Air)

A screengrab

Note the points where the loader appears to be a little stuck / the images sort of pop in:

stuck-infinite-scroll.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] MediaAnything that impacts the experience of managing media[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions