Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Fix list position restoration #1162

Merged
merged 1 commit into from
Mar 16, 2023
Merged

Fix list position restoration #1162

merged 1 commit into from
Mar 16, 2023

Conversation

chrisbanes
Copy link
Owner

Contains a workaround for https://issuetracker.google.com/issues/177245496.

Due to the way which paging loads data, it will always result in an initial empty state, and then the loaded items. That conflicts with the way which rememberLazyListState() and friends store their state, as they rely on the items being present at the time of (Android) state restoration. To workaround this, we use a different LazyListState while the lazy paging items are empty, and then switcheroo to the standard state once we know we have the items available.

Contains a workaround for  https://issuetracker.google.com/issues/177245496.

Due to the way which paging loads data, it will always result
in an initial empty state, and then the loaded items. That
conflicts with the way which rememberLazyListState() and
friends store their state, as they rely on the items being
present at the time of (Android) state restoration. To
workaround this, we use a different LazyListState while the lazy
paging items are empty, and then switcheroo to the standard state
once we know we have the items available.
@chrisbanes chrisbanes enabled auto-merge (squash) March 16, 2023 14:53
@chrisbanes chrisbanes merged commit e8daf06 into main Mar 16, 2023
@chrisbanes chrisbanes deleted the cb/paging-list-position branch March 16, 2023 15:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant