Skip to content

Fix incorrect calculation of DataEditor height. #1033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

infalmo
Copy link
Contributor

@infalmo infalmo commented May 11, 2025

No description provided.

@lukasmasuch lukasmasuch requested a review from Copilot June 16, 2025 23:27
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

The PR corrects the height calculation in DataEditor by summing each row’s actual height instead of using an averaged value.

  • Removed sampling-based average and floor division.
  • Updated the else branch to accumulate total header height plus the height of each row.
  • Preserved scrollbar width addition.
Comments suppressed due to low confidence (2)

packages/core/src/data-editor/data-editor.tsx:3992

  • This new dynamic row height summation logic should be covered by unit tests to verify correct height calculation for various rowHeight callback implementations.
h = totalHeaderHeight;

packages/core/src/data-editor/data-editor.tsx:3993

  • Iterating over every row to sum heights may introduce performance bottlenecks for large data sets. Consider memoizing row heights or computing cumulative heights outside of render to avoid repeated work.
for (let i = 0; i < rowsCountWithTrailingRow; i++) {

@BrianHung
Copy link
Collaborator

I believe sampling only 10 rows as opposed to all rows was an intentional performance optimization, as summing heights for thousands or millions of rows is an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants