-
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
Workspace: InOb-based load scheduler #31591
base: main
Are you sure you want to change the base?
Conversation
This pull request introduces 1 alert when merging 2db1d1e into 3a31bb2 - view on LGTM.com new alerts:
|
2db1d1e
to
8d5c939
Compare
This pull request introduces 1 alert when merging 337e8e9 into e1e8a4c - view on LGTM.com new alerts:
|
337e8e9
to
a33b707
Compare
Switching this to draft to look into deferred build approach. |
would this help get rid of |
* | ||
* @return {!Promise|undefind} | ||
*/ | ||
loadCallback() { |
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 feel that this (and build/layout) should not have callback
in their names. I gave the full reasoning here #31046 (comment). The tldr is that we are asking an element to load as opposed to informing it that load has happened.
I understand the desire to match CE's naming scheme, but IMO it doesn't make sense for these methods
@@ -396,6 +409,15 @@ function createBaseCustomElementClass(win) { | |||
return this.signals_.whenSignal(CommonSignals.BUILT); | |||
} | |||
|
|||
/** | |||
* Returns the promise that's rewsolved when the element has been 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.
nit: rewsolved --> resolved
@@ -877,6 +905,9 @@ function createBaseCustomElementClass(win) { | |||
/** @private */ | |||
connected_() { | |||
if (this.built_) { | |||
if (this.isLoadableV2()) { |
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.
Isn't one of the big points here that we don't need to branch on isBuilt()
anymore? I.e. scheduleLoad can be extracted from the condition since the definition of load()
is build().then(() => this.layout()))
@@ -1226,6 +1256,9 @@ function createBaseCustomElementClass(win) { | |||
const isReLayoutNeeded = this.implementation_.unlayoutCallback(); |
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.
nit: isReLayoutNeeded --> isRelayoutNeeded
const {win} = this.ampdoc_; | ||
const opts = { | ||
root: win.document, | ||
rootMargin: `${range * 100}% ${range * 25}%`, |
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.
can you explain the horizontal margin?
|
||
// Unschedule to reschedule with the new parameters. | ||
if (this.tasks_.has(id)) { | ||
this.unschedule_(resource, /* canceled */ true); |
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.
Should the be canceled=false
?
@@ -672,6 +700,9 @@ export class Resource { | |||
* @return {!../layout-rect.LayoutRectDef} | |||
*/ | |||
getLayoutBox() { | |||
if (this.loaderRectV2_) { |
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 v2 not need to manually move fixed
elements? What about intersect-resources
?
Dima Voytenko seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Partial for #31915.
This is an alternative to
intersect-resources
launch, but it address the following key goals:Key implementation notes:
Resources
class and moved to theLoadScheduler
.true
fromisLoadableV2
go into this loading path.TODO: