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

Scroll to an exact position when clicking the scrollbar track doesn't work in case of variable row heights and isVerticalScrollExact = true #712

Merged
merged 19 commits into from
Jan 10, 2024

Conversation

daniela-mateescu
Copy link
Contributor

Description

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

Copy link
Collaborator

@pradeepnschrodinger pradeepnschrodinger left a comment

Choose a reason for hiding this comment

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

LGTM with 1 question/suggestion

Comment on lines 143 to 147
if (state.isVerticalScrollExact) {
totalHeight += rowOffsetIntervalTree.get(rowIdx);
} else {
totalHeight += updateRowHeight(state, rowIdx);
}
Copy link
Collaborator

@pradeepnschrodinger pradeepnschrodinger Jan 3, 2024

Choose a reason for hiding this comment

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

Are we checking for isVerticalScrollExact just to avoid fetching the rows twice in the scenario where initializeRowHeightsAndOffsets() is already called?
If so, initializeRowHeightsAndOffsets() is only called when the no:of total rows or default row height changes.
So the new change effectively can lead to stale row heights for visible rows when isVerticalScrollExact is turned on.
This is a change in behavior because in FDT we always used to update visible row heights on the fly.

IMO, we don't need this change cause we're only re-fetching visible rows, and that's not a big deal in the grand scale of things.
If we really need this micro-optimization, another approach might be to make updateRowHeight() smarter, and have it only fetch the row height once per render. But again, this can be done later.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah i would also suggest to keep the same behaviour and avoid this optimization for now.

Copy link
Contributor Author

@daniela-mateescu daniela-mateescu Jan 8, 2024

Choose a reason for hiding this comment

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

Indeed, the isVerticalScrollExact was just added to avoid fetching the row heights twice.
I have removed this optimization.
Please let me know if it looks ok now.

@pradeepnschrodinger
Copy link
Collaborator

@karry08 , could you take primary here?

@karry08
Copy link
Collaborator

karry08 commented Jan 10, 2024

LGTM, changes look fine
Thanks for the updates

@karry08 karry08 merged commit 149f0ef into schrodinger:master Jan 10, 2024
3 checks passed
@pradeepnschrodinger
Copy link
Collaborator

Fix is available since v2.0.6.

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

Successfully merging this pull request may close these issues.

4 participants