primefaces / primereact

The Most Complete React UI Component Library
https://primereact.org
MIT License
6.79k stars 1.04k forks source link

Wrong displaying template preview (Skeleton) for infinity lazy loading scrollbar #5140

Open djuuuuus opened 12 months ago

djuuuuus commented 12 months ago

Describe the bug

I found not correct lazy scroll working. This is default example from manual https://primereact.org/datatable/#lazy_virtualscroll and it sandbox https://codesandbox.io/s/55lsf2

BTW if we check example with native lazy virtual scroller component https://primereact.org/virtualscroller/#lazy so it works well!

I am totally confused with mixing DataTable and virtualScrollerOptions image As example we can pass target items into 2 properties image or use appendOnly to add items for existing items to avoid removing all items and reach target behavior.

Also we don't have any onFetchRows event that I can use... I don't know, looks like I need manually add records with loading template according isLoading Flag at lazyLoad event firing and when loading will over, toggle isLoading flag and update itemTemplate for newly records (just switch keleton to usuall mark up for fethed records)

Reproducer

https://codesandbox.io/s/55lsf2

PrimeReact version

10.0.5

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

Problem conclude is: when you scrolling down then for current items should be added Skeleton records template, but in example (current implementation) it hide all records during loading and display skeleton only for first set of records.

I recorded video with behavior https://www.youtube.com/watch?v=kpRCQCFJEEU&ab_channel=Y

Expected behavior

FYI I am expect the same behavior https://codesandbox.io/s/y7lm45?file=/src/Demo.tsx

adrianmarpl commented 10 months ago

I have the same problem. Maybe there's a way to turn off loading skeleton manually?