PrimeNG p-table Virtual Scroll and Angular OnPush Change Detection Interoperability
0 reputation · 24 Aug 2020, 10:12 UTC
Goal
Render a PrimeNG p-table with virtualScroll enabled inside an Angular component using ChangeDetectionStrategy.OnPush. Data updates arrive asynchronously and replace the value input with a new array reference.
Constraint
PrimeNG documentation does not explicitly confirm OnPush compatibility for virtual scroll. The table tracks rows through IterableDiffer, but virtualized DOM recycling may depend on change detection running or a scroll event forcing a visible-region recalculation. Behavior may vary between PrimeNG versions, and Angular v18+ zoneless change detection remains experimental.
- Does an immutable array reference update refresh the virtual scroll viewport under OnPush without manual change-detection notification?
- Is manually marking the host component for check required after every data replacement?
- Is the observed behavior consistent from PrimeNG v16 through v18?