lorenzodejong / next-sanity-image

Utility for using responsive images hosted on the Sanity.io CDN with the Next.js image component.
MIT License
148 stars 19 forks source link

Spike in Sanity Bandwidth #60

Closed khalilp5 closed 1 year ago

khalilp5 commented 1 year ago

Has anyone seen a spike in sanity bandwidth after installing and implementing this package. I have installed this package last year around September and seen significant upward trend in bandwidth of Sanity.

Just want to understand if this package is causing this issue.

lorenzodejong commented 1 year ago

This package introduces responsive images, which means that images with different sizes are served corresponding to the user's screen size.

This package does nothing more apart from setting the properties for the 'next/image' component. This package does not perform any data calls to the Sanity API.

Anything that's true for the (browser) responsive image specification is also true for the use of this library: https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images.

khalilp5 commented 1 year ago

I mean does the initialisation of builder as seen in the source code incur bandwidth? I see the builder getting initialised in the hook call.

lorenzodejong commented 1 year ago

Nope, as i mentioned this library does not trigger any data calls. As you can see in the source code there's no async code, promises or even useEffect hooks.

Check your devtools network tab for the data calls that are being made. From there you can gain more insight in which images are being loaded. You'll notice that when you resize your screen network requests will trigger for the different image sizes.