Fix LazyGridScrollbarAdapter
to allow for items with unknown row/column at any position in visibleItemsInfo
#1707
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
LazyGridLayoutInfo.visibleItemsInfo
appears to allow items with "unknown" row or column to appear at the end of the list, which our current implementation ofLazyGridScrollbarAdapter
did not expect.Note that behavior was apparently removed in the latest code merged from upstream, because the bug reproduces in 1.7.1, but not in
jb-main
tip.Nevertheless, I think it's worthwhile (and not difficult) to work correctly in this case, which this PR implements.
Fixes https://youtrack.jetbrains.com/issue/CMP-7173
Testing
Only tested the code manually, as it's not possible to directly create a
LazyGridState
with the required state, and theLazyVerticalGrid
implementation injb-main
does not reproduce it (meaning the test will succeed even before the fix).6d27653db67c353e15d10292db44d79e8c9a5f7c
) to verify that the fix does indeed work.jb-main
to verify that scrollbar still works correctly withLazyVerticalGrid
.Code for testing:
Press the "+" button until the window is full of items. Pressing it again should crash the app with:
Release Notes
Fixes - Desktop