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
💅 Live story polishes #23074
💅 Live story polishes #23074
Conversation
Services.extensionsFor(this.ampdoc_.win).installExtensionForDoc( | ||
this.ampdoc_, | ||
'amp-live-list' | ||
); |
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.
I think we should one of two things here:
- Enforce that the extension is present at validation level
- If we decide to lazy load it, we should do so at a better time, when all the first pages assets are loaded. There's a custom even that's dispatched for that
My vote goes to (1), since we really want publishers to understand that using a live-story is expensive: it loads and parses (!!!) the full HTML document every 15s for every single user viewing it, and loads more code.
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.
I think @newmuis prefers if we dynamically add it ourselves
#23041 (comment)
430f829
to
67eaedb
Compare
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.
Cool!!
this.element.addEventListener(AmpEvents.DOM_UPDATE, () => { | ||
this.liveStoryManager_.update(); | ||
this.initializePages_().then(() => { | ||
this.setDesktopPositionAttributes_(this.activePage_); |
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.
Only if UIType.DESKTOP_PANELS
this.storeService_.subscribe(StateProperty.PAGE_IDS, () => { | ||
// Make sure the story is laid out before updating. | ||
this.forwardButton_.element.addEventListener( | ||
EventType.STORY_LOADED, |
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.
Does this work? I thought the STORY_LOADED
event was dispatched only once, and on the amp-story
element
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.
It does work. And I need this because sometimes it was calling onCurrentPageIndexUpdate_
before the story was loaded and it was throwing some errors related to the bookend.
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.
I'm probably missing something here, could you please explain how this works?
The two things I don't understand are:
- the
EventType.STORY_LOADED
event is never triggered onthis.forwardButton_.element
- the
EventType.STORY_LOADED
event is only triggered once when rendering the story, at the very beginning. You're appending theamp-live-list
after this event is dispatched, and it is never triggered again: how can this callback get executed?
* Installs amp-live-list extension automatically. * Updates pagination buttons in 3-panels view. * Updates distance attributes on new pages. * Supports adding a new page in the middle. w
dbb56d7
to
0edf123
Compare
* Live story polishes. * Installs amp-live-list extension automatically. * Updates pagination buttons in 3-panels view. * Updates distance attributes on new pages. * Supports adding a new page in the middle. w * reviews * reviews * use signals to wait for story to be laid out before updating pagination buttons * fix types * fix tests
Part of #21714