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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃И [Story performance] Lazy load share menu on desktop on-demand #37044

Closed
wants to merge 51 commits into from

Conversation

mszylkowski
Copy link
Contributor

@mszylkowski mszylkowski commented Nov 23, 2021

The share menu adds 3.5kB to amp-story and is not useful for the first paint of the page, so removing it will speed up the download and parsing of the amp-story bundle. The share menu will be fetched when users click on the share icon if there is no native share, and given that the click happens after all assets were downloaded, the share menu will be downloaded faster.

We can remove or simplify the requests service from amp-story with this change, since it's not used for any core amp-story functionality anymore.

Changes:

  • Make AmpSocialShare not live in the same file as the registerElement declaration so that we can import just the class.
  • Create amp-story-share-menu.js that builds the share menu for desktop or mobile when installed, and installs AmpSocialShare.
  • Keep the logic to use the native sharing functionality on amp-story-1.0.js so we don't have to download the share menu on mobile browsers.
  • Remove the styles imported into various places of amp-story.-1.0js which were causing the styles to show up 3 times on the bundle (now they are only on amp-story-share-menu-0.1.js)

@mszylkowski mszylkowski self-assigned this Nov 24, 2021
@mszylkowski mszylkowski added this to In progress in wg-stories Sprint via automation Nov 24, 2021
@mszylkowski mszylkowski changed the title 馃殌 [Story performance] Removed duplicated share styles [WIP] 馃殌 [Story performance] Lazy load share menu on desktop on-demand Dec 2, 2021
@mszylkowski mszylkowski changed the title 馃殌 [Story performance] Lazy load share menu on desktop on-demand 馃И [Story performance] Lazy load share menu on desktop on-demand Dec 10, 2021
@mszylkowski
Copy link
Contributor Author

Changes already merged in other PRs, closing

wg-stories Sprint automation moved this from In progress to Done Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

1 participant