-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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-virtual-scroll-viewport): emit events when cached templates are added/removed from the DOM #21742
Comments
As far as I can tell, this is working as expected. When a view is scrolled out of the viewport, we |
Yeah this is working as intended. The |
i also have the exact same problem. is there a workaround without using cachesize 0? |
No, as mentioned in the comment above, we would need a new API to emit events at the appropriate time |
will there be a way to know if an element was detached because of scrolling or because it was deleted by the user? |
there should be an option to destroy a specific item instead of caching |
I have the same issue. I think it would be cool to be able to delete the cache for a specific element by public removeElement(item) {
// HERE IS REMOVING LOGIC
// ...
this.cdkVirtualScrollViewport.clearItemCache(item.id);
} |
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. |
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. |
Reproduction
Use StackBlitz to reproduce your issue:
Steps to reproduce:
I have directive which shows tooltips
but when I delete element, the cache is no longer needed and is not relevant, because I deleted the element from the model, which means the
ngOnDestroy
method should workExpected Behavior
What behavior were you expecting to see?
When deleting a model, a template with an inactive model should not be cached, since this model no longer exists
Actual Behavior
What behavior did you actually see?
Workaround to use
templateCacheSize: 0
, but this is not a solution to the problem, because we are working with heavy templates that need to be cached.The
ngOnDestroy
method is not called, although we removed an element from the arrayEnvironment
The text was updated successfully, but these errors were encountered: