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

amp-social-share should not layout without a share endpoint #28285

Merged
merged 2 commits into from
May 8, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions extensions/amp-social-share/0.1/amp-social-share.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ class AmpSocialShare extends AMP.BaseElement {

/** @override */
layoutCallback() {
if (!this.shareEndpoint_) {
return Promise.resolve();
Copy link
Contributor

Choose a reason for hiding this comment

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

No user error/warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment to this effect -- the endpoint throws an error if it gets far enough to check it in buildCallback. This case handles when buildCallback returns early after the component hides itself, in which case the internal variable is null for not getting to be resolved. A warning is thrown in one of the hiding cases, and I don't think we need to add an error where this case didn't have one before.

}

const hrefWithVars = addParamsToUrl(
dev().assertString(this.shareEndpoint_),
this.params_
Expand Down