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

mention the scroll to index issue in TreeGrid #636

Merged
merged 8 commits into from
Jul 14, 2021
Merged

Conversation

sosa-vaadin
Copy link
Contributor

@sosa-vaadin sosa-vaadin commented Jul 8, 2021

Description

Add a mention to an issue with the scrollToIndex(index) method in TreeGrid.

Related issue: vaadin/flow-components#1016

@sosa-vaadin sosa-vaadin added the Language unchecked English language check has not been done label Jul 8, 2021
@sosa-vaadin sosa-vaadin removed the Language unchecked English language check has not been done label Jul 8, 2021
@sosa-vaadin sosa-vaadin marked this pull request as ready for review July 8, 2021 14:19
Copy link
Contributor

@magi42 magi42 left a comment

Choose a reason for hiding this comment

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

The "pre-order traverse" is a pretty deep technical term, so I simplified it. Please check that it's still technically correct.

articles/ds/components/tree-grid/index.asciidoc Outdated Show resolved Hide resolved
@magi42 magi42 added the Language checked English language check done label Jul 9, 2021
@@ -89,6 +89,17 @@ include::{root}/src/main/java/com/vaadin/demo/domain/Person.java[group=Java,tags

Tree Grid is not meant to be used as a navigation menu.

=== Avoid Using Scroll to Index
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels like an unncessarily detailed explanation of why scrollToIndex is problematic. We really just need to explain that scrollToIndex is not reliable and thus should be avoided.

Without the knowledge of the complete hierarchy, Tree Grid cannot reliably calculate an exact scroll position.
Therefore, the effective index of an item depends on the complete hierarchy of the tree.

.Index of items can vary
Copy link
Contributor

Choose a reason for hiding this comment

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

This admonition title doesn't do a very good job of summarizing the problem, which is that scrollToIndex is not reliable.

I propose omitting the long explanation above in favor of an admonition like:

.scrollToIndex not reliable
CAUTION: The behavior of the scrollToIndex method in Tree Grid is not deterministic due to lazy loading hierarchical data. Usage of this method is not recommended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language checked English language check done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants