mantine-datatable icon indicating copy to clipboard operation
mantine-datatable copied to clipboard

Infinite scroll in pages

Open sliterok opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. When I implement infinite scroll example on a big dataset the page starts to slow down and use a lot of memory, eventually completely freezing.

Describe the solution you'd like It should behave like pagination, where only a couple of pages are loaded into memory and those pages represent current window that user can or could see.
readPage is callback with params like from, to or pageNumber, should return list of records.
When initialized has no records but has totalRecords, calls readPage() to get records for the first page.
When user is close to the bottom of the window it should call the readPage() to get new page.

Describe alternatives you've considered make records not actual records but ids of those records, i.e. string[].
getRecordsByIds callback which accepts ids: string[] parameter and returns the records in batches. otherwise logic is similar to the variant above

Additional context I'm using OPFS to store and get a lot of records from virtual file storage in browser and I want to see how far it could go in terms of how smooth the experience is.

sliterok avatar Mar 15 '24 20:03 sliterok

Actually, I'm getting a lot of memory consumption even on 118 records with 10 columns.

UPD: I checked memory and CPU consumption starting from 7.1.5 to nowadays for my case: 7.1.5 — MEM: ~300MB, CPU: ~32% 7.3.0 — MEM: ~500MB, CPU: ~125% 7.4.0 — MEM: ~500MB, CPU: ~125% 7.6.1 — MEM: ~500MB, CPU: ~125%

What I was doing — just scrolled up and down in 30 seconds.

So, something happened in 7.3.0

isnifer avatar Apr 04 '24 09:04 isnifer

@sliterok unfortunately I don't have the time to consider this, but I'm open to discuss a PR if you fee like it.

@isnifer - if I remember correctly, the column toggling / resizing feature was added in 7.3 (see https://github.com/icflorescu/mantine-datatable/pull/483), so a certain performance cost is expected, but I haven't seen anything like the figures you posted above in my apps. In fact, in production, on Brave, what I'm typically seeing in terms of memory consumption is 100MB — 150MB...

icflorescu avatar Apr 04 '24 20:04 icflorescu