#How can I load the same asset multiple times without the multiple extra weight?

7 messages · Page 1 of 1 (latest)

tribal hawk
#

I have a page where I have to load the same asset several times (a list of assets that needs to be infinite and repeat), but that's going to have a huge payload so I'm wondering if it's not possible to load the same asset multiple times and the browser knows it's actually the same.
The videos from bunny CMS & Images from prismic.

I think it's specially for the videos, that are on autoplay...

south sandalBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

jovial oyster
#

I hope someone can correct me, but I think the browser just automatically knows it's the same asset.

If I make a bunce of <img /> components that all use the same src tag, the browser only downloads that image once, right?

const imgs = []
for (let i = 0; i < 10; ++i) imgs.push(
  <img key={i} src="http://google.com/my-img" />
)

return <>{imgs}</>
)
tribal hawk
#

For videos as well?

#

I tried a couple and it felt like the page ended up weighing 40mb

jovial oyster
#

The page may lag or feel slow, that has to do with the browser rendering a lot of content. But the network requests tab should show only one get request for the video.

tribal hawk
#

thank you for your input!