Skip to content

Add origin experiments check for amp-list#20592

Merged
cathyxz merged 7 commits intoampproject:masterfrom
cathyxz:feature/origin-trial
Jan 31, 2019
Merged

Add origin experiments check for amp-list#20592
cathyxz merged 7 commits intoampproject:masterfrom
cathyxz:feature/origin-trial

Conversation

@cathyxz
Copy link
Copy Markdown
Contributor

@cathyxz cathyxz commented Jan 30, 2019

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 for isOriginExperimentOn per @choumx 's original design, but I'm not sure that was ever implemented or where it should go (given the current async loading of origin-experiments-impl.js etc).

@dreamofabear
Copy link
Copy Markdown

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. 😄

@cathyxz cathyxz force-pushed the feature/origin-trial branch from 9aa66fe to 3481b52 Compare January 30, 2019 22:52
@cathyxz
Copy link
Copy Markdown
Contributor Author

cathyxz commented Jan 30, 2019

I've moved about 300 LOC related to the load-more feature out of amp-list.js. But the reason it is so long is that it has a few structural problems (given what we've extended it to be used for), and many inconvenient assumptions that we cannot break due to backwards compat. The upcoming V2 is where we're hoping to address that.

this.ssrTemplateHelper_ = new SsrTemplateHelper(
TAG, viewer, this.templates_);

const originTrialPromise = originExperimentsForDoc(this.getAmpDoc())
Copy link
Copy Markdown
Contributor

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 @@
/**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice refactoring

@cathyxz cathyxz merged commit 08aebba into ampproject:master Jan 31, 2019
@cathyxz cathyxz deleted the feature/origin-trial branch January 31, 2019 18:46
nbeloglazov pushed a commit to nbeloglazov/amphtml that referenced this pull request Feb 12, 2019
* 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
noranazmy pushed a commit to noranazmy/amphtml that referenced this pull request Mar 22, 2019
* 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
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.

5 participants