Skip to content

fix(cdk/scrolling): Prevent virtual scroll 'flickering' with zoneless #31240

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

atscott
Copy link
Contributor

@atscott atscott commented May 28, 2025

This fixes the perceived flickering due to the transform sometimes becoming visible with zoneless due to the macrotask-based scheduler. The transform cannot be simply moved inside afterNextRender because it causes differences in timing that can break certain scroll implementations (http://b/335066372).

This approach fiddles with the details of ngZone.run and avoiding unnecessary extra ApplicationRef.tick calls. We could instead put everything inside an ngZone.run and call ApplicationRef.tick in there, but that would result in a second tick when the ngZone.run exits.

fixes #29174

@atscott atscott requested a review from a team as a code owner May 28, 2025 14:39
@atscott atscott requested review from crisbeto and ok7sai and removed request for a team May 28, 2025 14:39
@atscott atscott added the target: patch This PR is targeted for the next patch release label May 29, 2025
This fixes the perceived flickering due to the transform sometimes becoming visible with zoneless due
to the macrotask-based scheduler. The transform cannot be simply moved
inside `afterNextRender` because it causes differences in timing that
can break certain scroll implementations (http://b/335066372).

This approach fiddles with the details of `ngZone.run` and avoiding
unnecessary extra ApplicationRef.tick calls. We could instead put
everything inside an ngZone.run and call ApplicationRef.tick in there,
but that would result in a second tick when the `ngZone.run` exits.

Fixes angular#29174
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: cdk/scrolling target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(cdk/scrolling): virtual-scroll flickers during scroll in zoneless mode
2 participants