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

fix: align startIndex & endIndex to lanes for masonry mode #933

Merged
merged 3 commits into from
Feb 25, 2025

Conversation

Azq2
Copy link
Contributor

@Azq2 Azq2 commented Feb 22, 2025

  1. startIndex should be aligned to the beginning of its lane
  2. endIndex should be aligned to the end of its lane
  3. count is actually lastIndex

Fix for #573

@Azq2
Copy link
Contributor Author

Azq2 commented Feb 24, 2025

Without fix

item.lane=
    | 1 | <-- row 0
| 0 | 1 | <-- row 1
| 0 | 1 | <-- row 2

With fix

item.lane=
| 0 | 1 | <-- row 0
| 0 | 1 | <-- row 1
| 0 | 1 | <-- row 2

@Azq2
Copy link
Contributor Author

Azq2 commented Feb 24, 2025

Easy way for reproducing bug - just set overscan 0 for MasonryVerticalVirtualizerVariable example

https://tanstack.com/virtual/latest/docs/framework/react/examples/variable

Copy link
Collaborator

@piecyk piecyk left a comment

Choose a reason for hiding this comment

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

Thanks, looks good, let's update the condition and we can merge it.

measurements[endIndex]!.end < scrollOffset + outerSize
) {
endIndex++
}

if (lanes != 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (lanes != 1) {
if (lanes > 1) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback, I fixed it

Copy link
Contributor

autofix-ci bot commented Feb 24, 2025

Hi! I'm autofix logoautofix.ci, a bot that automatically fixes trivial issues such as code formatting in pull requests.

I would like to apply some automated changes to this pull request, but it looks like I don't have the necessary permissions to do so. To get this pull request into a mergeable state, please do one of the following two things:

  1. Allow edits by maintainers for your pull request, and then re-trigger CI (for example by pushing a new commit).
  2. Manually fix the issues identified for your pull request (see the GitHub Actions output for details on what I would like to change).

Copy link

nx-cloud bot commented Feb 24, 2025

View your CI Pipeline Execution ↗ for commit a2cde5d.

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 2m 32s View ↗
nx run-many --target=build --exclude=examples/** ✅ Succeeded 19s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-25 06:14:01 UTC

Copy link

pkg-pr-new bot commented Feb 24, 2025

Open in Stackblitz

More templates

@tanstack/angular-virtual

npm i https://pkg.pr.new/@tanstack/angular-virtual@933

@tanstack/lit-virtual

npm i https://pkg.pr.new/@tanstack/lit-virtual@933

@tanstack/solid-virtual

npm i https://pkg.pr.new/@tanstack/solid-virtual@933

@tanstack/react-virtual

npm i https://pkg.pr.new/@tanstack/react-virtual@933

@tanstack/svelte-virtual

npm i https://pkg.pr.new/@tanstack/svelte-virtual@933

@tanstack/virtual-core

npm i https://pkg.pr.new/@tanstack/virtual-core@933

@tanstack/vue-virtual

npm i https://pkg.pr.new/@tanstack/vue-virtual@933

commit: a2cde5d

@piecyk
Copy link
Collaborator

piecyk commented Feb 24, 2025

@Azq2 thanks, btw did you noticed the formatting check?

@Azq2
Copy link
Contributor Author

Azq2 commented Feb 24, 2025

@piecyk Yes, I missed it. Now it's fixed.

@piecyk piecyk merged commit 5961e35 into TanStack:main Feb 25, 2025
6 checks passed
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