Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with gatsby-image Lazy Loading in Safari #7

Open
joealden opened this issue Nov 15, 2018 · 2 comments
Open

Issue with gatsby-image Lazy Loading in Safari #7

joealden opened this issue Nov 15, 2018 · 2 comments
Labels
blocked An issue that is dependent on something else happening before it can be resolved bug Something isn't working as it should

Comments

@joealden
Copy link
Owner

As shown here, Safari doesn't currently support the Intersection Observer API. This API is used in gatsby-image to detect if the image should be fetched. Read more about this here.

As I don't use an Apple machine, I'll have to test this at a later date. This may not actually be an issue as Gatsby's babel config might polyfill the Intersection Observer API. I say this because it states here in the Gatsby docs that they automatically provide polyfills for browsers that have a relatively large user base (and the latest version of Safari is definitely one of them).

@joealden joealden added the bug Something isn't working as it should label Nov 15, 2018
@joealden
Copy link
Owner Author

It turns out this is an issue. For some reason, when there are only 24 posts, the page is a whopping 11MB, when on Chrome and Firefox it is 250KB-450KB. It looks like this is happening because not only is Safari downloading all the post's full size images on page load, it is downloading all the images about 5 times for some reason.

@joealden joealden changed the title Potential Issue with gatsby-image Lazy Loading in Safari Issue with gatsby-image Lazy Loading in Safari Jan 14, 2019
@joealden joealden added the blocked An issue that is dependent on something else happening before it can be resolved label Jan 15, 2019
@joealden
Copy link
Owner Author

joealden commented Jan 15, 2019

For this issue to be investigated further, issue #9 should be resolved. This is because the virtualisation of the list may help reduce the overall payload size, as even with Safari not having the Intersection Observer API, it may mean that only the posts actually in the DOM have their images loaded.

It should also be noted that Intersection Observer is implemented in Safari TP (Technology Preview), so this likely won't be an issue when a new version of Safari is cut.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked An issue that is dependent on something else happening before it can be resolved bug Something isn't working as it should
Projects
None yet
Development

No branches or pull requests

1 participant