Skip to content
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

Table virtualizer doesn't render enough rows after a height increase, until a scroll #1008

Closed
rajsite opened this issue Jan 30, 2023 · 4 comments · Fixed by #1030
Closed
Assignees
Labels
bug Something isn't working

Comments

@rajsite
Copy link
Member

rajsite commented Jan 30, 2023

🧹 Tech Debt

It looks like on a fresh load of a component the virtualizer is miscounting the space and creating more rows than necessary. This isn't user facing (extra rows outside the viewport are not visible) but may be an unnecessary performance cost. We may find it is a minor cost, I think the page size may be used or something, should verify we never i.e. instance every row in the view unnecessarily for a large data set.

Found during #1000 where a workaround was added for a test to nudge the scroll so the correct, smaller amount of rows ins rendered in the viewport:

element.viewport.scrollTop = 2;

Additional discussion: https://github.com/ni/nimble/pull/1000/files#r1089556479

@rajsite rajsite added tech debt triage New issue that needs to be reviewed labels Jan 30, 2023
@jattasNI jattasNI removed the triage New issue that needs to be reviewed label Jan 31, 2023
@msmithNI msmithNI self-assigned this Feb 1, 2023
@msmithNI msmithNI added bug Something isn't working and removed tech debt labels Feb 1, 2023
@msmithNI
Copy link
Contributor

msmithNI commented Feb 1, 2023

This looks like it could be a user-visible bug.
To reproduce, open the table story in Storybook, use the large data set. Change table height to 150px in DevTools. Then change table height to something bigger like 400px (copy/paste in the new height so it happens in a single frame, instead of per character as you type). The # of rows will be wrong (too small for the new size) until you scroll.

It does look to be related to the dependencies update somehow. Those same steps don't reproduce the issue in this Storybook from my virtualization PR (before the dependency updates went in).

@msmithNI msmithNI changed the title Table virtualizer overdraws before a scroll Table virtualizer doesn't render enough rows after a height increase, until a scroll Feb 3, 2023
@msmithNI
Copy link
Contributor

msmithNI commented Feb 3, 2023

FYI @rajsite the dependencies PR did result in a new TanStack Virtual version getting pulled in since we don't pin that version currently (3.0.0-beta.34 => 3.0.0-beta.41).

I was able to trace this back to a TanStack Virtual change. The issue is reproducible without our code so I made a test case and filed them a bug - TanStack/virtual#492

@rajsite
Copy link
Member Author

rajsite commented Feb 3, 2023

Interesting. it looks like the 3.0 prereleases have been going on for almost exactly a year https://github.com/TanStack/virtual/releases/tag/v3.0.0-alpha.0

Do we treat it like regular releases if they are in perpetual prerelease (and keep the semver range as is and handle breaks) or pin it and do controlled updates between prerelease versions? We don't have renovate on and our manual bump cadence is infrequent so not sure I feel strongly either way.

Do we pin at a lower version that doesn't include the regression until the issue is fixed?

@msmithNI
Copy link
Contributor

msmithNI commented Feb 4, 2023

I'm not sure if they have a timeframe for v3 being non-beta. Their bug template said "v3 on the horizon with beta builds" but as you said that's been true for a pretty long time now.

I'll probably give them the weekend to see if there's any movement on the bug I filed / see what they say. We can pin if needed after a few days.

@nate-ni nate-ni added this to the Table Milestone 2 milestone Feb 7, 2023
msmithNI added a commit that referenced this issue Feb 7, 2023
…increase, until a scroll (#1030)

# Pull Request

## 🤨 Rationale

Resolves #1008 

## 👩‍💻 Implementation

- Update TanStack Virtualizer package to latest (beta44). The [TanStack
Virtual bug I filed](TanStack/virtual#492) was
fixed in beta43.

## 🧪 Testing

- Tested in Storybook locally
- Autotests. Removed workaround in autotest that triggered a scroll
after changing table height, which was due to this bug.

## ✅ Checklist

- [x] I have updated the project documentation to reflect my changes or
determined no changes are needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
4 participants