Skip to content

🐛 [amp story shopping] Do not render shopping CTA if no shopping tags are on the page#37503

Merged
processprocess merged 10 commits intoampproject:mainfrom
processprocess:install
Feb 2, 2022
Merged

🐛 [amp story shopping] Do not render shopping CTA if no shopping tags are on the page#37503
processprocess merged 10 commits intoampproject:mainfrom
processprocess:install

Conversation

@processprocess
Copy link
Copy Markdown
Contributor

Building the attachment was refactored as part of #37278 to be a separate component and introduced a regression which was not caught since Percy diffs were broken at the time of submitting the PR.

This PR removes dead code that previously prevented the CTA from being built if no shopping-tags are on the page (originally done in #37004) and puts the functionality in amp-story-shopping-attachment.
It also renames renderOpenAttachmentUI_ to installPageAttachmentExtension_ to better describe functionality.

@amp-owners-bot
Copy link
Copy Markdown

amp-owners-bot bot commented Jan 27, 2022

Hey @gmajoulet! These files were changed:

extensions/amp-story-shopping/0.1/amp-story-shopping-attachment.js
extensions/amp-story/1.0/amp-story-page.js

Hey @newmuis! These files were changed:

extensions/amp-story/1.0/amp-story-page.js

Copy link
Copy Markdown
Contributor

@mszylkowski mszylkowski left a comment

Choose a reason for hiding this comment

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

Nit:

If there are no shopping tags, the attachment extension will still be fetched right? How often would this happen?

We could prevent that by removing the tag from the querySelector on amp-story-page and on shopping-attachment install the extension.

Copy link
Copy Markdown
Contributor

@mszylkowski mszylkowski left a comment

Choose a reason for hiding this comment

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

Could be useful to add tests to check whether the attachment is built or not, code is 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants