Repository navigation
test: fix GalleryNavigationTest flake on Android 30 - #7
Merged
thisislvca merged 3 commits intoOct 17, 2026
Merged
Conversation
A restored LazyGridState only holds an index. When the grid is first measured against fewer items than that (another tab's results still showing, or a catalog that has not loaded), the index is clamped and the scroll resets to the top. On slow CI emulators this made GalleryNavigationTest lose the library position after recreate(). Remember the first visible photo id and offset per grid, save it, and re-apply it once the photo is present. A user scroll cancels the pending restore.
thisislvca
force-pushed
the
test/fix-gallery-navigation-api30
branch
from
October 17, 2026 18:15
dba6b9a to
f4b318c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
GalleryNavigationTest.libraryLeadsWithPhotosAndDestinationsPreserveTheirOwnState failed intermittently on API 30 CI after recreate(): the library grid was at the top, so the tile was never displayed.
Root cause: a restored LazyGridState only holds an index. If the grid is first measured against fewer items than that index (another tab's results still showing after the tab switch, or an unloaded catalog), the index is clamped and the scroll resets. Reproduced on CI with a 30x repeated copy of the test (failure: scroll=0 right after tapping the Library tab); 0 failures in 30 repeats after the fix.
Fix: GridAnchor remembers the first visible photo id and offset per grid, saves it, and re-applies it once the photo is present; user scrolling cancels it. GridAnchorTest covers the clamp deterministically (fails without the fix).