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

always fall back to native browser lazy loading #355

Merged
merged 1 commit into from
Jan 29, 2021
Merged

Conversation

steve8708
Copy link
Contributor

this helps ensure best possible perf scores

@steve8708 steve8708 requested a review from a team as a code owner January 29, 2021 18:16
@@ -282,6 +282,7 @@ class ImageComponent extends React.Component<any> {
},
}),
}}
loading="lazy"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things:

  1. Should we add some logic to determine if loading is present in the browser and then have that bypass our built in lazy loading behavior so we don't end up negating the built in browser lazy loading? https://web.dev/browser-level-image-lazy-loading/#how-do-i-handle-browsers-that-don't-yet-support-lazy-loading
  2. Ideally we don't lazy load images above the fold, so should we include logic here to only add this attribute to ones we actually want to lazy load?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my thoughts on these were

  1. I lean against for a first test, bc our lazy loading has nice fade in animations and in theory if the browser sees it's above the fold it'll load in immediately anyway
  2. I leaned against this too bc our pre computed above/below fold detection isn't as accurate as a users browsers for their exact device size, and so google page speed will ding that for some specific device you should have lazy loaded an image. plus the browser should see that image is already in view and load immediately if it is anyway

a large impetus here is

  1. places like shopstyle who have lazy loading off, and are dinged for it but this one attr will fix that
  2. times that our above/below fold lazy flagging isn't exactly accurate for the specific device
  3. easy migration path - e.g. just start using this now and later we can turn off our JS if this works well
  4. support older browser and new ones pretty seamlessly without additional code/logic

basically, if my assumption is right that the browser will identify correctly when an image is or isn't in view - the only net affect here is any time our lazy loading is wrong the image will pop in. any time its' right ppl still get the nice fade animation. and over time if the browser native is better and more supported we'll just turn our lazy off for everything and let the browser do it's thing

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that reasoning. Works for me 👍

@steve8708 steve8708 merged commit 9b0d3e9 into master Jan 29, 2021
apaniel added a commit to apaniel/builder that referenced this pull request Feb 9, 2021
* [FIX] typo in catchallBuilderPage class (BuilderIO#315)

* Feature/better dynamic dropdown (BuilderIO#313)

* better dynamic dropdown

* remove rollup

* bump major version

* release gatsby patch

* app plugin examples (BuilderIO#316)

* app plugin examples

* prettier

* Update README.md

* Update README.md

* Update README.md

* app context types

* plugins

* @builder.io utils and tests

* cleanup

* nextjs - example : cleanup warnings for deprecated prefetch param,  use param prop to fetch slug (BuilderIO#317)

* utils tests and publish

* Fix build on plugins/shopify (BuilderIO#319)

* Update ShopifyProductPicker.tsx

* prettier

* full prettier

* fix build

* set moduleresolution to resolve json

* util resolve json

* untrack compiled files

* eof

* fix utils tests

* Add preview field types and handles for products and collections (BuilderIO#320)

* release shopify plugin on dev

* Add admin cli [dev] (BuilderIO#321)

* first pass

* second pass with progress bar, working

* point to qa endpoint

* remove auto gen from git, add readme, commands

* pprettier

* prettier didnt catch this

* feedback: promisify access

* prettier

* Update packages/cli/README.md

Co-authored-by: Korey Kassir <korey@builder.io>

* feedback

* feedback2

Co-authored-by: Korey Kassir <korey@builder.io>

* release admin cli dev version

* use post on admin graphql client (BuilderIO#322)

* use post on admin graphql client

* use the right key

* pass content options up to parent when requesting updated content, to address the case of incluldeRefs (BuilderIO#323)

* fix a/b tests on data model in static mode (BuilderIO#326)

* update input type

* Update README.md

* dead code cleanup (BuilderIO#330)

* dead code cleanup

* more cleanup

* BuilderComponent -> RenderContent (BuilderIO#332)

* utils: fix build and add a method to target specific props and extend (BuilderIO#329)

* fix buid and add a method to target specific props and extend

* fix readme

* fix rebuiltds

* eof

* Update packages/utils/README.md

Co-authored-by: Armando Pérez Marqués <gmandx@gmail.com>

* Update packages/utils/README.md

Co-authored-by: Armando Pérez Marqués <gmandx@gmail.com>

* rewording

* Update README.md

* Update packages/utils/README.md

Co-authored-by: Korey Kassir <korey@builder.io>

Co-authored-by: Armando Pérez Marqués <gmandx@gmail.com>
Co-authored-by: Korey Kassir <korey@builder.io>

* Allow the usage of targeting attributes in the url (BuilderIO#331)

* Allow the usage of targeting attributes in the url

* ensure the behaviour always works with a test

* rename dynamic dropdown to diverge from older non-compatible versions (BuilderIO#334)

* rename dynamic dropdown to diverge from older non-compatible versions

* keep the name of editor

* releases

* React SDK spelling and grammar corrections (BuilderIO#337)

* bump react package dev version

* Builder.registerComponent -> Builder.registerBLock (BuilderIO#335)

* Builder.registerComponent -> Builder.registerBLock

* prettier

* Fix symbols in symbols (BuilderIO#338)

* fix symbols in symbols

* dev bumps

* version bumps

* Update README.md

* Update README.md

* fix utils package missing index after publish (BuilderIO#340)

* noWebp option for images - to fix svg issues (BuilderIO#341)

* svg fix (BuilderIO#342)

* formatting (BuilderIO#343)

* Update README.md

* fix cli command (BuilderIO#346)

* widget async updates (BuilderIO#347)

* prettier

* Bump axios from 0.19.0 to 0.21.1 in /packages/shopify (BuilderIO#325)

Bumps [axios](https://github.com/axios/axios) from 0.19.0 to 0.21.1.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v0.21.1/CHANGELOG.md)
- [Commits](axios/axios@v0.19.0...v0.21.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump semantic-release from 15.13.31 to 17.2.3 in /packages/amp (BuilderIO#307)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 15.13.31 to 17.2.3.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v15.13.31...v17.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump semantic-release from 15.13.31 to 17.2.3 in /packages/email (BuilderIO#306)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 15.13.31 to 17.2.3.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v15.13.31...v17.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump semantic-release from 15.13.31 to 17.2.3 in /packages/webcomponents (BuilderIO#304)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 15.13.31 to 17.2.3.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v15.13.31...v17.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump semantic-release from 15.13.31 to 17.2.3 in /packages/react (BuilderIO#305)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 15.13.31 to 17.2.3.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v15.13.31...v17.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump semantic-release from 15.13.31 to 17.2.3 in /packages/widgets (BuilderIO#303)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 15.13.31 to 17.2.3.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v15.13.31...v17.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump immer from 3.3.0 to 8.0.1 in /packages/react-native/examples/expo (BuilderIO#333)

Bumps [immer](https://github.com/immerjs/immer) from 3.3.0 to 8.0.1.
- [Release notes](https://github.com/immerjs/immer/releases)
- [Commits](immerjs/immer@v3.3.0...v8.0.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update README.md (BuilderIO#349)

Fix typo in README

* updated Builder site example (BuilderIO#348)

* updated Builder site example

* update readmes

* fixes

* publish core, react, widgets

* Update React@17.0.1 (BuilderIO#324)

React recently upgrade to the latest [17.0.1](https://github.com/facebook/react/blob/master/CHANGELOG.md#1701-october-22-2020),
despite the major version, this seems to be a safe upgrade since it doesn't introduce any difficult breaking changes.

Thanks @antonhalim!

* Codegen support (alpha) (BuilderIO#351)

* codegen

* updates

* updates

* bumps

* updates

* updates

* prettier

* add back the null fallbacks - not sure how got lost

* extend the shopify plugin to import collections, products and registe… (BuilderIO#350)

* extend the shopify plugin to import collections, products and register webhooks to syn with builder

* remove unused code

* point to builder api

* Update plugins/shopify/src/actions/import-product-data.ts

Co-authored-by: Armando Pérez Marqués <gmandx@gmail.com>

Co-authored-by: Armando Pérez Marqués <gmandx@gmail.com>

* Update README.md

* fix empty key binding

* pr update

* ignore content prop when editing or previewing (BuilderIO#354)

* plugin-shopify: release dev and fix error when editing model is not yet loaded (BuilderIO#352)

* Update README.md

* always fall back to native browser lazy loading (BuilderIO#355)

* Update README.md

* full fix for content prop (BuilderIO#356)

* Latest site updates (BuilderIO#357)

* latest site updates

* update

* comment

* Super duper final preview/edit fixes (BuilderIO#358)

* more preview and edit fixes

* fix previewing

* slight optimization

* final version bump for final testing

* use latest builder versions in example repo so all works as expected

* simple vue SDK and Nuxt example (BuilderIO#359)

* vue SDK and Nuxt example

* vue in readme

* fix readme typo

* Update README.md (BuilderIO#360)

typoes

* vue fixes (BuilderIO#361)

* Update README.md

* print api key after successful space creation- (BuilderIO#364)

* include spaces site url in editing url template (BuilderIO#362)

* include spaces site url in editing url template

* fix loading indicators out of place

* release dev

* feedbac

* release dev

* don't refetch vue content (BuilderIO#363)

* release minor (BuilderIO#365)

* Vue and Nuxt improvements (BuilderIO#366)

* client side routing for Vue and Nuxt updates for 404 handling

* fix 404 handling

* Update README.md

* Update README.md

* Update README.md

* publish cli

* release vue package

* Prevent propagation from the root content component (BuilderIO#368)

* release:patch core and react

* fix inline symbols and bump react version

* New year, new logo

* Update README.md

Co-authored-by: Kevin Barns <k.barnoin@gmail.com>
Co-authored-by: Korey Kassir <korey@builder.io>
Co-authored-by: Aziz Abbas <aziz@builder.io>
Co-authored-by: Steve Sewell <steve@builder.io>
Co-authored-by: Saurabh Bhatia <saurabh.a.bhatia@gmail.com>
Co-authored-by: Armando Pérez Marqués <gmandx@gmail.com>
Co-authored-by: Tony Tamplin <github@tony.dev>
Co-authored-by: Jay Phelps <hello@jayphelps.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mosaab Abbas <musaababs@gmail.com>
Co-authored-by: Anton Halim <github@antonhalim.com>
Co-authored-by: bdlocks <bdlocksk@gmail.com>
teleaziz added a commit that referenced this pull request Feb 9, 2021
* merge master (#3)

* [FIX] typo in catchallBuilderPage class (#315)

* Feature/better dynamic dropdown (#313)

* better dynamic dropdown

* remove rollup

* bump major version

* release gatsby patch

* app plugin examples (#316)

* app plugin examples

* prettier

* Update README.md

* Update README.md

* Update README.md

* app context types

* plugins

* @builder.io utils and tests

* cleanup

* nextjs - example : cleanup warnings for deprecated prefetch param,  use param prop to fetch slug (#317)

* utils tests and publish

* Fix build on plugins/shopify (#319)

* Update ShopifyProductPicker.tsx

* prettier

* full prettier

* fix build

* set moduleresolution to resolve json

* util resolve json

* untrack compiled files

* eof

* fix utils tests

* Add preview field types and handles for products and collections (#320)

* release shopify plugin on dev

* Add admin cli [dev] (#321)

* first pass

* second pass with progress bar, working

* point to qa endpoint

* remove auto gen from git, add readme, commands

* pprettier

* prettier didnt catch this

* feedback: promisify access

* prettier

* Update packages/cli/README.md

Co-authored-by: Korey Kassir <korey@builder.io>

* feedback

* feedback2

Co-authored-by: Korey Kassir <korey@builder.io>

* release admin cli dev version

* use post on admin graphql client (#322)

* use post on admin graphql client

* use the right key

* pass content options up to parent when requesting updated content, to address the case of incluldeRefs (#323)

* fix a/b tests on data model in static mode (#326)

* update input type

* Update README.md

* dead code cleanup (#330)

* dead code cleanup

* more cleanup

* BuilderComponent -> RenderContent (#332)

* utils: fix build and add a method to target specific props and extend (#329)

* fix buid and add a method to target specific props and extend

* fix readme

* fix rebuiltds

* eof

* Update packages/utils/README.md

Co-authored-by: Armando Pérez Marqués <gmandx@gmail.com>

* Update packages/utils/README.md

Co-authored-by: Armando Pérez Marqués <gmandx@gmail.com>

* rewording

* Update README.md

* Update packages/utils/README.md

Co-authored-by: Korey Kassir <korey@builder.io>

Co-authored-by: Armando Pérez Marqués <gmandx@gmail.com>
Co-authored-by: Korey Kassir <korey@builder.io>

* Allow the usage of targeting attributes in the url (#331)

* Allow the usage of targeting attributes in the url

* ensure the behaviour always works with a test

* rename dynamic dropdown to diverge from older non-compatible versions (#334)

* rename dynamic dropdown to diverge from older non-compatible versions

* keep the name of editor

* releases

* React SDK spelling and grammar corrections (#337)

* bump react package dev version

* Builder.registerComponent -> Builder.registerBLock (#335)

* Builder.registerComponent -> Builder.registerBLock

* prettier

* Fix symbols in symbols (#338)

* fix symbols in symbols

* dev bumps

* version bumps

* Update README.md

* Update README.md

* fix utils package missing index after publish (#340)

* noWebp option for images - to fix svg issues (#341)

* svg fix (#342)

* formatting (#343)

* Update README.md

* fix cli command (#346)

* widget async updates (#347)

* prettier

* Bump axios from 0.19.0 to 0.21.1 in /packages/shopify (#325)

Bumps [axios](https://github.com/axios/axios) from 0.19.0 to 0.21.1.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v0.21.1/CHANGELOG.md)
- [Commits](axios/axios@v0.19.0...v0.21.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump semantic-release from 15.13.31 to 17.2.3 in /packages/amp (#307)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 15.13.31 to 17.2.3.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v15.13.31...v17.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump semantic-release from 15.13.31 to 17.2.3 in /packages/email (#306)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 15.13.31 to 17.2.3.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v15.13.31...v17.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump semantic-release from 15.13.31 to 17.2.3 in /packages/webcomponents (#304)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 15.13.31 to 17.2.3.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v15.13.31...v17.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump semantic-release from 15.13.31 to 17.2.3 in /packages/react (#305)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 15.13.31 to 17.2.3.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v15.13.31...v17.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump semantic-release from 15.13.31 to 17.2.3 in /packages/widgets (#303)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 15.13.31 to 17.2.3.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v15.13.31...v17.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump immer from 3.3.0 to 8.0.1 in /packages/react-native/examples/expo (#333)

Bumps [immer](https://github.com/immerjs/immer) from 3.3.0 to 8.0.1.
- [Release notes](https://github.com/immerjs/immer/releases)
- [Commits](immerjs/immer@v3.3.0...v8.0.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update README.md (#349)

Fix typo in README

* updated Builder site example (#348)

* updated Builder site example

* update readmes

* fixes

* publish core, react, widgets

* Update React@17.0.1 (#324)

React recently upgrade to the latest [17.0.1](https://github.com/facebook/react/blob/master/CHANGELOG.md#1701-october-22-2020),
despite the major version, this seems to be a safe upgrade since it doesn't introduce any difficult breaking changes.

Thanks @antonhalim!

* Codegen support (alpha) (#351)

* codegen

* updates

* updates

* bumps

* updates

* updates

* prettier

* add back the null fallbacks - not sure how got lost

* extend the shopify plugin to import collections, products and registe… (#350)

* extend the shopify plugin to import collections, products and register webhooks to syn with builder

* remove unused code

* point to builder api

* Update plugins/shopify/src/actions/import-product-data.ts

Co-authored-by: Armando Pérez Marqués <gmandx@gmail.com>

Co-authored-by: Armando Pérez Marqués <gmandx@gmail.com>

* Update README.md

* fix empty key binding

* pr update

* ignore content prop when editing or previewing (#354)

* plugin-shopify: release dev and fix error when editing model is not yet loaded (#352)

* Update README.md

* always fall back to native browser lazy loading (#355)

* Update README.md

* full fix for content prop (#356)

* Latest site updates (#357)

* latest site updates

* update

* comment

* Super duper final preview/edit fixes (#358)

* more preview and edit fixes

* fix previewing

* slight optimization

* final version bump for final testing

* use latest builder versions in example repo so all works as expected

* simple vue SDK and Nuxt example (#359)

* vue SDK and Nuxt example

* vue in readme

* fix readme typo

* Update README.md (#360)

typoes

* vue fixes (#361)

* Update README.md

* print api key after successful space creation- (#364)

* include spaces site url in editing url template (#362)

* include spaces site url in editing url template

* fix loading indicators out of place

* release dev

* feedbac

* release dev

* don't refetch vue content (#363)

* release minor (#365)

* Vue and Nuxt improvements (#366)

* client side routing for Vue and Nuxt updates for 404 handling

* fix 404 handling

* Update README.md

* Update README.md

* Update README.md

* publish cli

* release vue package

* Prevent propagation from the root content component (#368)

* release:patch core and react

* fix inline symbols and bump react version

* New year, new logo

* Update README.md

Co-authored-by: Kevin Barns <k.barnoin@gmail.com>
Co-authored-by: Korey Kassir <korey@builder.io>
Co-authored-by: Aziz Abbas <aziz@builder.io>
Co-authored-by: Steve Sewell <steve@builder.io>
Co-authored-by: Saurabh Bhatia <saurabh.a.bhatia@gmail.com>
Co-authored-by: Armando Pérez Marqués <gmandx@gmail.com>
Co-authored-by: Tony Tamplin <github@tony.dev>
Co-authored-by: Jay Phelps <hello@jayphelps.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mosaab Abbas <musaababs@gmail.com>
Co-authored-by: Anton Halim <github@antonhalim.com>
Co-authored-by: bdlocks <bdlocksk@gmail.com>

* async map to context

* formatting

Co-authored-by: Kevin Barns <k.barnoin@gmail.com>
Co-authored-by: Korey Kassir <korey@builder.io>
Co-authored-by: Aziz Abbas <aziz@builder.io>
Co-authored-by: Steve Sewell <steve@builder.io>
Co-authored-by: Saurabh Bhatia <saurabh.a.bhatia@gmail.com>
Co-authored-by: Armando Pérez Marqués <gmandx@gmail.com>
Co-authored-by: Tony Tamplin <github@tony.dev>
Co-authored-by: Jay Phelps <hello@jayphelps.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mosaab Abbas <musaababs@gmail.com>
Co-authored-by: Anton Halim <github@antonhalim.com>
Co-authored-by: bdlocks <bdlocksk@gmail.com>
@samijaber samijaber deleted the native-lazy-image branch February 18, 2022 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants