mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 22:17:03 +05:30
fix(android): avoid triggering a refresh on saving posts
The underlying issue is still not resolved since work on paging has stalled out in Store5, but this trades the bad UX of an unwanted refresh for the slightly less bad UX of the saved state sometimes being stale. Fixes #558
This commit is contained in:
parent
c8d1491196
commit
6f424ae2d5
2 changed files with 1 additions and 4 deletions
|
@ -54,9 +54,7 @@ fun NetworkPosts(
|
|||
ReportDrawnWhen { lazyPagingItems.itemCount > 0 }
|
||||
val isRefreshing by
|
||||
remember(lazyPagingItems) {
|
||||
derivedStateOf {
|
||||
lazyPagingItems.loadState.refresh == LoadState.Loading && lazyPagingItems.itemCount == 0
|
||||
}
|
||||
derivedStateOf { lazyPagingItems.loadState.refresh == LoadState.Loading }
|
||||
}
|
||||
val pullRefreshState = rememberPullRefreshState(isRefreshing, lazyPagingItems::refresh)
|
||||
Box(modifier = modifier.fillMaxSize().pullRefresh(pullRefreshState)) {
|
||||
|
|
|
@ -100,7 +100,6 @@ fun LobstersCard(
|
|||
Modifier.clickable(role = Role.Button) {
|
||||
localSavedState = !localSavedState
|
||||
postActions.toggleSave(post)
|
||||
refresh()
|
||||
},
|
||||
)
|
||||
HorizontalDivider(modifier = Modifier.width(48.dp))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue