Skip to content
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

fix(scrolling): update virtual scroll viewport size on resize #18058

Merged
merged 1 commit into from
Dec 29, 2019

Conversation

crisbeto
Copy link
Member

We currently cache the size of the virtual scroll viewport, but it may become inaccurate if it's a percentage of the page viewport and the page is resized. These changes add an extra call that'll update the virtual scroll viewport on resize.

Fixes #16802.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Dec 28, 2019
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 28, 2019
We currently cache the size of the virtual scroll viewport, but it may become inaccurate if it's a percentage of the page viewport and the page is resized. These changes add an extra call that'll update the virtual scroll viewport on resize.

Fixes angular#16802.
@crisbeto crisbeto force-pushed the 16802/virtual-scroll-on-resize branch from b4a3b7b to 6729515 Compare December 28, 2019 06:19
scrollDispatcher: ScrollDispatcher) {
scrollDispatcher: ScrollDispatcher,
/**
* @deprecated `viewportRuler` parameter to become required.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just mark this @breaking-change, not @deprecated since the change is making it required rather than removing it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve been marking these as deprecated in other places, because it’s something standard that’ll show up in people’s tooling, whereas breaking-change is something we made up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I'm not sure if this will show up the way we want though, it will probably show viewportRuler as a deprecated param. What might work better is TS's method overloading. We can mark the old signature deprecated and the new one not deprecated.

Obviously we already have this same pattern all over the code base, but it might be nice to start doing it the way I suggested going forward, I'll leave it up to you

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point that we should be using overloads instead, but I realized that Ivy won't generate the correct code if the constructor is overloaded with a different number of parameters. I've submitted a PR to fix the compiler here angular/angular#34590 so until that gets released I'll keep it as is.

@mmalerba
Copy link
Contributor

Apply merge-ready once the comment is addressed

@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Dec 29, 2019
@mmalerba mmalerba merged commit c36466c into angular:master Dec 29, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cdk-virtual-scroll: viewport does not render correct number of items after browser zoom
3 participants