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
R1: schedule amp-bind targets #37619
Conversation
// If amp-bind is trying to mutate an uninitialized BaseElement, it is probably about time | ||
// to initialize it. | ||
const scheduler = getSchedulerForDoc(this); | ||
scheduler.scheduleAsap(this); |
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.
How's this different than a component setting deferredMount = false
when it needs to mutate before mount?
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.
First, this affects every component instead of only a specific one.
Second, the mount of the component (build/layout) will now be deferred until the amp-bind event occurs instead of on document load. Especially for an initially hidden component it may make sense to defer initialization.
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.
Would this allow us to remove deferredMount = false
from the components that define it?
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.
The only component that does so is amp-sidebar
. Answer is maybe. Unsure right now why deferredMount=false was added to begin with.
summary
Schedules an element to be laid out if it is the target of an amp-bind mutation.
Fixes #37400