-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Add origin experiments check for amp-list #20592
Conversation
Drive by comment on a WIP PR, but while we're in a refactor-y mood maybe we should split up amp-list which is 1K+ LOC already. 😄 |
9aa66fe
to
3481b52
Compare
I've moved about 300 LOC related to the load-more feature out of |
extensions/amp-list/0.1/amp-list.js
Outdated
@@ -156,6 +149,17 @@ export class AmpList extends AMP.BaseElement { | |||
this.ssrTemplateHelper_ = new SsrTemplateHelper( | |||
TAG, viewer, this.templates_); | |||
|
|||
const originTrialPromise = originExperimentsForDoc(this.getAmpDoc()) |
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.
discussed offline but we want short-circuit and promise.resolve
immediately if no load-more
@@ -0,0 +1,251 @@ | |||
/** |
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.
nice refactoring
* Check for origin trial experiments in amp-list * Fix type check on origin-experiments-impl * Whitelist origin experiments dependency check * Refactor load more creation and show/hide logic out of amp-list * Fix incorrect variable * Stub getAmpDoc on the AmpDocService prototype * Short circuit origin trial logic if no amp-list-load-more attribute
* Check for origin trial experiments in amp-list * Fix type check on origin-experiments-impl * Whitelist origin experiments dependency check * Refactor load more creation and show/hide logic out of amp-list * Fix incorrect variable * Stub getAmpDoc on the AmpDocService prototype * Short circuit origin trial logic if no amp-list-load-more attribute
Adds a check to see if
amp-list-load-more
is within the set of origin experiments enabled for this given page. Some refactoring happened due to the fact that this check returns a promise and not a direct boolean. I debated adding a piece of code that would automatically use toggleExperiment to turn on all experiments in origin trial during runtime, but decided against this as it could inadvertently enabled experiments for all users who had once visited an origin trial page. I think a more ideal solution would be to implement a check forisOriginExperimentOn
per @choumx 's original design, but I'm not sure that was ever implemented or where it should go (given the current async loading oforigin-experiments-impl.js
etc).