components
components copied to clipboard
fix(cdk/scrolling): virtual list not updating when source array is mutated
When an array is passed to cdkVirtualFor
, it falls back to creating an ArrayDataSource
which won't emit if the array has changed. Since the intention of the cdkVirtualFor
is to be (more or less) a drop-in alternative for ngFor
, it is expected that it'll update if the data has changed. These changes add a new type of data source that will allow us to detect changes on the data and to update the view.
Note: I went with adding a new type of data source, rather than using the iterable differ directly, because it would've meant having to maintain two different code paths inside the directive. Furthermore, I can see this being useful in cdk/tree
and cdk/table
as well.
Fixes #14635. Fixes #14501.
@jelbourn @mmalerba how should we proceed with this one?
Why don't we just add the methods to DataSource
with a default implementation that does nothing? That seems like the cleanest solution to me
@jelbourn WDYT?
Is the issue fixed? when will this be available for us?
can we approve the fix now? even thou it is not "perfect" it seems to me it does not impact other areas. later it could be improved but at the moment we need the functionality which is even in basic ion-list (in ionic). thank you.