fix(home): restore pull-to-refresh on home feeds
The `onRefresh: () -> Unit` parameter in the second `RefresheableBox` overload was shadowed by a local `val onRefresh` of the same name. The recursive `onRefresh()` call inside the launched coroutine therefore re-invoked the local wrapper instead of the caller's callback, so pulling down on the home feed never actually triggered `feedState.invalidateData()` or the DVM refresh. Rename the local wrapper to `onRefreshWrapped` so the parameter remains visible inside the lambda.
This commit is contained in:
@@ -73,7 +73,7 @@ fun RefresheableBox(
|
||||
) {
|
||||
var isRefreshing by remember { mutableStateOf(false) }
|
||||
val scope = rememberCoroutineScope()
|
||||
val onRefresh: () -> Unit = {
|
||||
val onRefreshWrapped: () -> Unit = {
|
||||
isRefreshing = true
|
||||
scope.launch {
|
||||
onRefresh()
|
||||
@@ -84,7 +84,7 @@ fun RefresheableBox(
|
||||
|
||||
PullToRefreshBox(
|
||||
isRefreshing = isRefreshing,
|
||||
onRefresh = onRefresh,
|
||||
onRefresh = onRefreshWrapped,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
content = content,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user