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

virtual-scroll: call component hooks when attached/detached #16324

Open
aalbericio opened this issue Jun 19, 2019 · 2 comments
Open

virtual-scroll: call component hooks when attached/detached #16324

aalbericio opened this issue Jun 19, 2019 · 2 comments
Labels
area: cdk/scrolling feature This issue represents a new feature or feature request rather than a bug or bug fix P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@aalbericio
Copy link

aalbericio commented Jun 19, 2019

Feature Description

Call specific hooks on components/renderers that are "attached" or "detached" from the virtual scroll rendering zone to gain full control on "destroying" or "re-creating" a renderer.

Use Case

Virtual scroll is a great feature inside the CDK but due to its core nature of reusing component instances, it may cause memory leaks in not-so complex renderers.

Imagine a renderer (component) initializes some subscriptions at constructor/init level (of course, we added an OnDestroy handler to remove them once the component is destroyed). Due to the native feature for recycling component instances of the virtual-scroll, this OnDestroy method may not be called unless the container is destroyed.

It would be useful to have some kind of "hook" (in the component livecycle hook) that we could implement to properly control all these possible memory leaks due to component recycling.

If I'm not wrong, virtual-scroll internally "attaches" or "detaches" components so it could be enough to have a OnAttach or OnDetach or, since this is a custom feature of virtual-scroll and we don't want to interfere into these framework hooks, any other specific hook.

@aalbericio aalbericio added the feature This issue represents a new feature or feature request rather than a bug or bug fix label Jun 19, 2019
@mmalerba mmalerba added the needs triage This issue needs to be triaged by the team label May 20, 2020
@crisbeto crisbeto added area: cdk/scrolling P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels May 29, 2020
@angular-robot
Copy link
Contributor

angular-robot bot commented Feb 21, 2022

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

@angular-robot
Copy link
Contributor

angular-robot bot commented Mar 13, 2022

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: cdk/scrolling feature This issue represents a new feature or feature request rather than a bug or bug fix P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

4 participants