Preload image textures before entering viewport


I’m working with a Grid component that dynamically loads media items, including images, titles, and media types. The data for each MediaItem component is provided by the parent component using setters. I’m setting the image source (src) for the texture before the component is attached to the render tree, typically before the _setup or _init hooks.

However, I’m facing an issue: when a key event occurs (like keydown) and the media items enter the viewport, the images don’t appear immediately. It takes about half a second for the images to load. During this short period, the row appears empty with only the titles visible.

I’m looking for a solution to preload the image textures so that the media items enter the viewport with the textures already loaded. How can I achieve this?

Hi, could anyone from lightning team give us some help or advice please ?

Many thanks