-
Notifications
You must be signed in to change notification settings - Fork 4.1k
🐛 [Story performance] Disabling animations on initial page when first loaded #36668
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
Changes from 1 commit
9e73016
df7609a
a87b850
f9e3ef4
a2637df
eae03ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,8 +141,7 @@ const Attributes = { | |
| RETURN_TO: 'i-amphtml-return-to', | ||
| STANDALONE: 'standalone', | ||
| SUPPORTS_LANDSCAPE: 'supports-landscape', | ||
| // Attributes that desktop css looks for to decide where pages will be placed | ||
| VISITED: 'i-amphtml-visited', // stacked offscreen to left | ||
| VISITED: 'i-amphtml-visited', | ||
| }; | ||
|
|
||
| /** | ||
|
|
@@ -360,6 +359,7 @@ export class AmpStory extends AMP.BaseElement { | |
| `amp-story-page#${escapeCssSelectorIdent(pageId)}` | ||
| ); | ||
| page.setAttribute('active', ''); | ||
| page.setAttribute('i-amphtml-initial', ''); | ||
| } | ||
|
|
||
| this.initializeStyles_(); | ||
|
|
@@ -1415,12 +1415,6 @@ export class AmpStory extends AMP.BaseElement { | |
| if (oldPage) { | ||
| oldPage.setState(PageState.NOT_ACTIVE); | ||
|
|
||
| // Indication to know where to display the page on the desktop | ||
| // ribbon-like animation. | ||
| this.getPageIndex(oldPage) < pageIndex | ||
| ? setAttributeInMutate(oldPage, Attributes.VISITED) | ||
| : removeAttributeInMutate(oldPage, Attributes.VISITED); | ||
|
|
||
| if (oldPage.isAd()) { | ||
| this.storeService_.dispatch( | ||
| Action.SET_ADVANCEMENT_MODE, | ||
|
|
@@ -1474,6 +1468,10 @@ export class AmpStory extends AMP.BaseElement { | |
| this.systemLayer_.setDeveloperLogContextString( | ||
| this.activePage_.element.id | ||
| ); | ||
|
|
||
| if (oldPage) { | ||
| setAttributeInMutate(oldPage, Attributes.VISITED); | ||
| } | ||
| }, | ||
| ]; | ||
|
|
||
|
|
@@ -2368,7 +2366,7 @@ export class AmpStory extends AMP.BaseElement { | |
| /** @private */ | ||
| replay_() { | ||
| this.storeService_.dispatch(Action.SET_NAVIGATION_PATH, []); | ||
| const switchPromise = this.switchTo_( | ||
| this.switchTo_( | ||
| dev().assertElement(this.pages_[0].element).id, | ||
| NavigationDirection.NEXT | ||
| ); | ||
|
|
@@ -2377,14 +2375,6 @@ export class AmpStory extends AMP.BaseElement { | |
| this.pages_[0].setState(PageState.NOT_ACTIVE); | ||
| this.pages_[0].setState(PageState.PLAYING); | ||
| } | ||
|
|
||
| // Reset all pages so that they are offscreen to right instead of left in | ||
| // desktop view. | ||
| switchPromise.then(() => { | ||
| this.pages_.forEach((page) => | ||
| removeAttributeInMutate(page, Attributes.VISITED) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this PR I want to make the removal of animations more targeted:
This means that when the story is replayed we don't need to skip the animations, especially because we're not on the initial page any more on some cases. However, I understand your point so I'll re-implement this feature with better semantics (and probably remove this attribute altogether). |
||
| ); | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
|
|
||
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.
This attribute is very broad and could mean literally anything, please be a bit more specific and/or consistent with how things are named in the JavaScript to make it easier