-
-
Notifications
You must be signed in to change notification settings - Fork 208
Open
Description
Description
I’m seeing this behavior in our Ionic 7 / Angular 20 app when using @rx-angular/template
’s *rxVirtualFor
with variable‐height items:
- I push a brand-new array into the virtual scroll (e.g. when the day changes).
- I immediately call
viewport.scrollToIndex(0, 'auto')
. - Only the first 2–3 items render. The rest remain blank until I manually scroll, at which point the viewport measures and paints them.
That suggests the viewport is still using stale height calculations after the data swap.
Steps to Reproduce
- Bind an
Observable<T[]>
into:
<rx-virtual-scroll-viewport
[dynamic]="getItemSize"
[runwayItems]="runway"
#viewport>
<div *rxVirtualFor="let item of items$; trackBy: '_id'">
<!-- item template -->
</div>
</rx-virtual-scroll-viewport>
- In component code swap the list:
this.items$.next([...newItems]);
viewport.scrollToIndex(0, 'auto');
- Observe only a couple of rows render.
- Scroll manually → the rest appear.
Environment
- Angular: 20.0.5
- Ionic: 7.x
- @rx-angular/cdk: 20.0.0
- @rx-angular/template: 20.0.0
- Browser: Chrome 115.0.5790.170
- OS: macOS Monterey 12.6
Questions / Requests
- Is there an equivalent to CDK’s
checkViewportSize()
onRxVirtualScrollViewportComponent
to force an immediate reflow of dynamic or autosize strategies? - If not, what is the recommended pattern to make sure the full list is measured and rendered immediately when swapping the data array? (I’m currently working around it by waiting for the
(rendered)
callback or usingrequestAnimationFrame
.) - Would you consider exposing a public “refresh” API (e.g.
refresh()
orreflow()
) so thatscrollToIndex(0)
always works as expected after an array swap?
Thanks in advance for any pointers or code snippets!
drakedeatonukhoebbelsB
Metadata
Metadata
Assignees
Labels
No labels