Sticky header in a useReactTable table with useVirtualizer disappears when scrolling
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- react, typescript
- Bereich
- frontend, performance
Rechercherichtung
Beginne mit der verlinkten minimalen CodeSandbox-Reproduktion und untersuche, wie useReactTable, useVirtualizer, der scrollbare Container und der Wrapper, der die virtualisierten Elemente enthält, miteinander interagieren. Reproduziere das Verschwinden des thead beim Scrollen in Chrome und überprüfe anschließend, dass der Sticky-Header sichtbar bleibt, ohne dass sich die virtualisierten Zeilen fälschlicherweise ausdehnen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the bug
When using a react-table together with vritualizer and a sticky header the sticky header disappears when scrolling. This is due to the fact that when combining the two the table should be wrapped in two divs:
- The container that takes the height that should be taken up. This is the div that is scrollable
- The div that directly wraps the container and takes the height of all the virtual items combined
Since the table element at any given time only contains the visible rows (plus overscan) the table itself has a height smaller than the wrapper div (nr. 2). This causes the sticky header to disappear when you scroll down since the sticky header cannot escape the table element.
Your minimal, reproducible example
https://codesandbox.io/p/devbox/tanstack-react-virtual-example-dynamic-mr8t3x
Steps to reproduce
- Add
position: stickyto thetheadelement - Scroll down the table and watch how the header dissapears
Expected behavior
The header should stay on top since it is sticky.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Chrome
tanstack-virtual version
3.0.0-beta.68
TypeScript version
5.3.2
Additional context
I've tried getting rid of the wrapper div (nr. 2) and setting the height: ${getTotalSize()}px` directly on the table element but this causes the rows' height the grow because there are only ever enough rows to fit on the screen (plus overscan) but having the table the full height causes the rows to evenly divide the space between each other (making them a lot larger).
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 7.2k
- Forks
- 495
- Ø Merge
- 23 Std. 16 Min.
- Gemergte PRs (30 T.)
- 19
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus TanStack/virtual
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
Maintainer antworten meist innerhalb von 1 Tag
-
With `useScrollendEvent`, scrollToIndex and scrollToEnd stop short when the target moves while they settleEvtl. vergeben @Darkatse hat das vor 11 Tagen übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
Maintainer antworten meist innerhalb von 1 Tag
-
svelte-virtual renders no rows when the scroll element is bound after the store subscribesEvtl. vergeben @clean99 hat das vor 15 Tagen übernommen. Offen
Schwierigkeit 4/5 1-2 Tage Anfängerfreundlichkeit 35/100
Maintainer antworten meist innerhalb von 1 Tag
-
anchorTo: 'end' does not keep the reading position when only paddingStart changesEvtl. vergeben @duongynhi000001-crypto hat das vor 15 Tagen übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 30/100
Maintainer antworten meist innerhalb von 1 Tag
-
anchorTo: 'end' loses the end when the scroll element shrinksEvtl. vergeben @langleyd hat das vor 44 Tagen übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in TanStack/virtual
Ähnliche Issues
-
inference/go type/feature
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 72/100
anomalyco/opencode#65148 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
truapi-release
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
paritytech/product-sdk#529 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Add: Mansudae TVOffenapproved check:passed streams:add
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
Maintainer antworten meist innerhalb von 1 Tag
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per nodeOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
devlikeapro/waha#2369 ·
Maintainer antworten meist innerhalb von 5 Tagen