-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(cdk/scrolling): add input to enable append-only mode in virtual scroll viewport #22986
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
feat(cdk/scrolling): add input to enable append-only mode in virtual scroll viewport #22986
Conversation
82bdbb8
to
5ab7b87
Compare
@@ -121,3 +121,10 @@ custom strategy by creating a class that implements the `VirtualScrollStrategy` | |||
providing it as the `VIRTUAL_SCROLL_STRATEGY` on the component containing your viewport. | |||
|
|||
<!-- example(cdk-virtual-scroll-custom-strategy) --> | |||
|
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.
It's been a while since I've looked at this code, but how is this different to setting the cache size to zero? I was under the impression that if a view can't be cached, it'll be recreated.
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.
I think the difference is that with cache size zero, it won't reuse already created views, but it will remove them from the DOM. The idea with this change is to have a mode where it never removes anything from the DOM, only adds.
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.
+1
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.
I updated the description to clarify this behavior.
5ab7b87
to
aca3b1c
Compare
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.
LGTM
aca3b1c
to
186f763
Compare
Updated the commit message to match the new PR title. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This PR adds an
appendOnly
input tocdk-virtual-scroll-viewport
, which disables view recycling so items remain in the DOM even after they scroll out of view. This can be more performant for scroll viewports that render complex components that may be expensive to remove or insert at the beginning of the list while scrolling up.Option questions
appendOnly
changes after initialization? For example, if a user scrolls to the bottom of a list containing 2k items, then enablesappendOnly
, the viewport will render all 2k items.