Open el-meher opened 4 years ago
It seems that when you reset cachedData
, you need to re-initialize it to what you had in the beginning
https://stackblitz.com/edit/angular-ehqgvp-tu1zid?file=app/cdk-virtual-scroll-data-source-example.ts
I investigated the problem and it seems related to FixedSizeVirtualScrollStrategy.prototype._updateRenderedRange. When the data is empty, it should set the new range to (0,0) but it doesn't. The logic behind this scroll strategy is that data could only expand, so the size of the range.
What are you trying to do?
I have a virtual scroll coupled to a paginated request. At some point, the user may need to refresh the list. the new result of the query may be empty so I am setting the data to empty.
What troubleshooting steps have you tried?
The virtual scroll show only the first page after refresh
Reproduction
We can only help if we can reproduce the problem ourselves.
I tried to make a minimal example https://stackblitz.com/edit/angular-ehqgvp-b5qa5x?file=app/cdk-virtual-scroll-data-source-example.ts
Steps to reproduce:
Environment