Skip to content

test(cdk/scrolling): add test for contracting range #19030

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

Merged

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Apr 9, 2020

Adds a test to the scrolling module for the case where the amount of data is reduced.

@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 Apr 9, 2020
@crisbeto crisbeto requested a review from andrewseguin as a code owner April 9, 2020 08:58
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 9, 2020
Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

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

LGTM

@mmalerba mmalerba added lgtm action: merge The PR is ready for merge by the caretaker labels Apr 9, 2020
@mmalerba mmalerba removed the lgtm label Jul 31, 2020
@crisbeto crisbeto changed the title fix(scrolling): virtual scroll viewport returning range larger than data when switching to smaller set fix(cdk/scrolling): virtual scroll viewport returning range larger than data when switching to smaller set Aug 17, 2021
@crisbeto crisbeto force-pushed the 19029/virtual-scroll-rendered-range branch from 0f42873 to 6076801 Compare August 17, 2021 20:21
Comment on lines 287 to 288
// The range should never be greater than the data.
range.end = Math.min(range.end, this.getDataLength());

Choose a reason for hiding this comment

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

To keep it consistent, you could do the same for range.start. I think it would be good to not assume that the virtual scroll always starts at 0.

range.start = Math.max(range.start, 0)

Choose a reason for hiding this comment

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

Relates to #23578

@andrewseguin andrewseguin removed the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 28, 2021
@andrewseguin
Copy link
Contributor

There are some cases in Google where users do not attach with cdkVirtualFor, in particular with using the viewport for the table. The viewport never attaches and learned about the data size. I'm not even sure this is supported. Check out test/429009689 for test results.

I think this logic should end up in the strategies to avoid this

@andrewseguin andrewseguin removed the action: merge The PR is ready for merge by the caretaker label Feb 21, 2022
Adds a test to the scrolling module for the case where the amount of data is reduced.
@crisbeto crisbeto force-pushed the 19029/virtual-scroll-rendered-range branch from 6076801 to 06d6b6c Compare March 21, 2022 05:59
@crisbeto crisbeto changed the title fix(cdk/scrolling): virtual scroll viewport returning range larger than data when switching to smaller set test(cdk/scrolling): add test for contracting range Mar 21, 2022
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker merge safe labels Mar 21, 2022
@crisbeto
Copy link
Member Author

The underlying issue was resolved in a different PR. I'll keep the unit test from this one.

@crisbeto crisbeto added target: major This PR is targeted for the next major release and removed target: patch This PR is targeted for the next patch release labels Mar 21, 2022
@crisbeto crisbeto merged commit bf4ba23 into angular:master Mar 21, 2022
forsti0506 pushed a commit to forsti0506/components that referenced this pull request Apr 3, 2022
Adds a test to the scrolling module for the case where the amount of data is reduced.
@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 Apr 21, 2022
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 P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants