question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic row height not working in Grid

See original GitHub issue

Describe the bug

When cells within each row have varying size content, I would expect the height of the row (and in turn each cell) to be the height of the largest cell in the row. However, it seems that this is not working, unless I’m doing something incorrectly. I’ve read through several issues related to dynamically sizing rows (https://github.com/TanStack/virtual/issues/376, https://github.com/TanStack/virtual/issues/235, https://github.com/TanStack/virtual/issues/28) but they are all either out-dated, closed without resolution, or not quite the same use case. In the codesandbox example, i’m virtualizing the columns but forcing them all to render in order to illustrate this issue. You can see that each cell within the row is measured correctly according to the content, but I think the height of each cell should be adjusted to account for the maximum cell height, right?

Your minimal, reproducible example

https://codesandbox.io/s/window-scroll-virtualized-ltfdib?file=/src/main.tsx

Steps to reproduce

  1. See the codesandbox repro

Expected behavior

Height of each cell should be Math.max(...cellHeights)

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: macOs
  • Browser: Chrome 107

tanstack-virtual version

3.0.0-beta.23

TypeScript version

No response

Additional context

No response

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.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
piecykcommented, Nov 19, 2022

@jamesonhill maybe go with a bit different approach, first position rows, then render columns as one block, thanks to minHeight: row.size + ResizeObserver there is no need for custom measureElementMaxSize to store max size.

Checkout this https://codesandbox.io/s/window-scroll-virtualized-forked-pzebvz?file=/src/main.tsx

0reactions
jamesonhillcommented, Nov 19, 2022

@piecyk Brilliant. Thanks a ton for your help. This could be a good example to add to the documentation. Maybe i’ll add a PR for it, but will close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Grid - Auto height rows, sizing to content - Stack Overflow
Based on what I'm seeing, LucioB is saying that with align-items: start , the bottom of the grid content ends where the content...
Read more >
grid-auto-rows - CSS: Cascading Style Sheets - MDN Web Docs
The grid-auto-rows CSS property specifies the size of an implicitly-created ... min-height ) of the grid items occupying the grid track.
Read more >
Dynamic row height, based on children height not working as ...
Dynamic row height, based on children height not working as expected. ... It has survived not only five centuries " /> <BoxView Grid.Row="2" ......
Read more >
grid-auto-rows | CSS-Tricks
And what that tells a grid container is that the grid-auto-rows can be no taller than the minimum value, but no shorter than...
Read more >
allow dynamic row height · Issue #205 · ag-grid/ag ... - GitHub
i will be implementing dynamic row height in the new year. it's not a small change. as you see, the grid uses 'row...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found