#cdk-virtual-scroll autosize, how to trigger re-render?

10 messages · Page 1 of 1 (latest)

crude field
#

I am currently using cdk-virtual-scroll with the experimental autosize strategy from @angular/cdk-experimental
When an element's height in the virtual scroll changes (specifically when something gets much shorter), virtual scroll seems unaware that it needs to call in more elements to maintain a filled viewport.

I tried looking into the source of autosize, but I lack the experience to know what's going on in there:
https://github.com/angular/components/blob/main/src/cdk-experimental/scrolling/auto-size-virtual-scroll.ts

I can think of a few approaches to solve this problem (eg. find some way to trigger the existing mechanism for re-rendering), but so far those have been unsuccessful.

Can I hint to the virtual scroll that an element changed size somehow? Can I tell it "hey idiot, make sure you have enough elements loaded"?

Thanks in advance—sorry no stackblitz for this (yet)

GitHub

Component infrastructure and Material Design components for Angular - angular/components

hoary arch
#

Hello folk

#

I think in this case you just need to wait !

#

In the docs says this strategy is not good already

#

Try to see if someone opened a issue around the material repo

#

And if this has some workaround

crude field
#

oh god, I just realized, this code hasn't been touched in four years... it's probably abandoned 😭

crude field
#

Angular's implementation is literally the best I've seen... other packages are either too slow or too glitchy. Literally all I need is some way to tell it that it needs to check again and make sure it has enough elements displayed...

crude field
#

anyone found a solution yet?