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

Loading assets twice #3

Closed companion-core closed 3 years ago

companion-core commented 3 years ago

First, thanks for the hook! Currently using it as described in the documentation, but just noticed that it's loading assets twice!

it loads e.g. w=3840 and w=1920

using these props

{...imageProps} // the output of useNextSanityImage
sizes="(max-width: 800px) 100vw, 800px"

image

lorenzodejong commented 3 years ago

Thanks for opening this issue. I tried setting this up using my demo application but could not reproduce this issue. Could you describe the specific scenario in which this occurs, stating:

Optionally it might also help if you could post a reproducible code example on https://codesandbox.io/. Thanks in advance!

pietvanzoen commented 3 years ago

I think I'm seeing a similar thing. It might specifically be with Safari and related to this? https://github.com/vercel/next.js/issues/19478

lorenzodejong commented 3 years ago

Looks like this is related to the Next issue. I'll keep this issue open to track vercel/next.js#19478. If the issue still occurs after that issue has been resolved we'll investigate.

lorenzodejong commented 3 years ago

It seems like a fix has been published in the latest canary release of Next.js (https://github.com/vercel/next.js/commit/7dd99faee7fa2c793bf19c41001a71a5dac1fdec). Can you confirm this is no longer reproducible in this specific version of Next.js? If this is the case, this issue can be closed since this is not an issue with this specific library.

lorenzodejong commented 3 years ago

Just retested this and it seems like this issue is solved on Safari 14.0.3 in this version. Closing this issue as this will be fixed in Next.js.