-
Notifications
You must be signed in to change notification settings - Fork 3.9k
🚀 [Story performance] Move open page attachment UI to extension #37278
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
🚀 [Story performance] Move open page attachment UI to extension #37278
Conversation
Hey @gmajoulet, @newmuis! These files were changed:
|
@@ -94,14 +97,20 @@ const ctaLabelFromAttr = (element) => | |||
* @param {?string} label | |||
* @return {?string} | |||
*/ | |||
const openLabelOrFallback = (element, attachmentEl, label) => | |||
attachmentEl.tagName === 'AMP-STORY-SHOPPING-ATTACHMENT' | |||
? localize(element, LocalizedStringId_Enum.AMP_STORY_SHOPPING_CTA_LABEL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the localize
helper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The localize
helper is used inside amp-story
because part of it is "instantiate a new LocalizationService if not instantiated already" (since the amp-story bundle has that service, it's free to do that in there). On extensions we don't want to add the service in the bundle, just fetch it from the document, so we can't use that localize
helper or we would be bundling it into all the extensions that need it.
Moves the open page attachment UI (the "swipe up" button / hint) to the
amp-story-page-attachment
extension.Removes an extra 1.8kB of amp-story, and adds 2kB to amp-story-page-attachment.