-
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
🐛 Properly indicate when FIE is done for no-signing #31530
Conversation
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.
Looks great.
src/friendly-iframe-embed.js
Outdated
/** @private @const {!Promise} */ | ||
this.winLoadedPromise_ = Promise.all([loadedPromise, this.whenReady()]); | ||
if (this.ampdoc) { | ||
this.whenReady().then(() => this.ampdoc.setReady()); | ||
// TODO(ccordry): wait for renderComplete after no signing launch. | ||
const readyPromise = this.spec.skipHtmlMerge |
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's probably best to just use one promise here: whenRenderComplete()
, but resolve renderComplete_
promise at the same time as readyPromise
when this.spec.skipHtmlMerge
. That way this new promise will always be "correct" from API point of view. Otherwise, right now, it could end up unresolved in some cases.
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.
Done.
src/friendly-iframe-embed.js
Outdated
// TODO(ccordry): wait for renderComplete after no signing launch. | ||
const readyPromise = this.spec.skipHtmlMerge | ||
? this.whenRenderComplete() | ||
: this.whenReady(); |
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.
Let's rename this function to avoid confusion. This should be whenRenderStarted()
.
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.
Done.
@@ -465,6 +489,13 @@ export class FriendlyIframeEmbed { | |||
} else { | |||
this.signals_.signal(CommonSignals.RENDER_START); | |||
} | |||
|
|||
// TODO(ccordry): remove when no-signing launched. |
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.
FYI: this class and this mode are used by most of our unit tests. So we'd need to switch them to streaming as well.
* signal end of transfer * tests * use one promise * fix tests * renaming * fix animation
Tell FIE ampdoc that it is complete only after all elements have been transferred. Tested manually and if I am in no-signing + fie-resources this will solve the malformed json errors. This will probably cost us a bit of speed, but will iterate on fie-resource building logic in follow up.
Partial #27189