-
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
Remove viewportCallback from the rest of non-ads related components. #30802
Conversation
42cd69b
to
f3f36f9
Compare
f57b2a0
to
f7e681c
Compare
Hey @alanorozco! These files were changed:
|
} | ||
|
||
/** @override */ | ||
unlayoutCallback() { | ||
unobserveWithSharedInOb(this.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.
There's one more nuance I completely missed. In the old world, before unlayoutCallback
is executed, the resources system would also call viewportCallback(false)
. See this code. I don't think it matters most of the time, but it's important here. When it matters, I think this can simply be done in the unlayoutCallback
like this:
unlayoutCallback() {
unobserveWithSharedInOb(this.element);
this.viewportCallback_(false);
}
Please check other 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.
Nice catch! I didn't know that happened. Indeed this case is to hide the animating image so it stops taking up CPU/GPU?
I've updated this case and checked the other 7, only one of which seemed like it could be mildly important (3d-gltf).
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.
Ah, I just found that pauseCallback()
should also trigger viewportCallback(false)
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.
Hm, the only one that also has a pauseCallback
is gltf, and it doesn't seem super necessary in this case.
f0f41a0
to
2af4d6f
Compare
82978ca
to
6127ab1
Compare
E2E testing found a legitimate bug in the amp-carousel change I had made. The bug was that I had observe/unobserve within Should be fixed with the latest push. |
Found another (small) issue. Some unit tests call Could either change the test or make the code more resilient, opted for introducing bound viewportCallbacks |
I don't believe two adjacent |
…k twice in a row without unlayout" This reverts commit 213f4f4.
Just sanity tested each of the components via local server examples, and all LGTM. Merging now |
…mpproject#30802) * viewportCallback: remove all but ads * remove rest of this.isInViewport calls() * rebase * typefixin * unlayout --> vpcb(false) * fix timeago test * fix test, and missed two carousel cases. * private --> protected * more test fix * e2e test found bugs. woot, testing works. * add TODO * ugh. lint * fix potentially wrong test that happens to call layoutCallback twice in a row without unlayout * Revert "fix potentially wrong test that happens to call layoutCallback twice in a row without unlayout" This reverts commit 213f4f4. * fix the tests
summary
Partial for #30620
Included components:
Notes: