primefaces / primefaces/primereact
VirtualScroller: Flickering in certain circumstances
@mertsincan is already working on this.
Since Sep 22, 2022.
- Dominant language
- CSS
- Stars
- 8.3k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
I'm using the DataTable with virtual scrolling and it is flickering for me. I have a big data table with many columns and it flickers when scrolling. It's hard to recreate in codesandbox, but it should be sufficient was you scroll.
I believe it's occurring due to this line:
https://github.com/primefaces/primereact/blob/7d5a8d12953e3d70303c09134c0a02e3209b3605/components/lib/virtualscroller/VirtualScroller.js#L252
This line sets a new style (translate3d) for the next data chunk, which causes the table to display it. Then, it's corrected after.
Usually this is fast enough to not be seen, but in my instance, I think it's due to using body calls in the DataTable, it slows this process down and causes flickering.
This might be solvable by immediately setting the table back to the correct position after updating the translate3d style, but I am experimenting with it and haven't been able to find a fix.
Reproducer
https://codesandbox.io/s/primereact-test-forked-cwr1db
PrimeReact version
8.0.1
React version
18.x
Language
ES6
Build / Runtime
Next.js
Browser(s)
No response
Steps to reproduce the behavior
- Make a DataTable with a lot of dynamic body template columns.
- Scroll the table and notice flickering.
Expected behavior
Table should not flicker.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.