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) }
|
var isRefreshing by remember { mutableStateOf(false) }
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
val onRefresh: () -> Unit = {
|
val onRefreshWrapped: () -> Unit = {
|
||||||
isRefreshing = true
|
isRefreshing = true
|
||||||
scope.launch {
|
scope.launch {
|
||||||
onRefresh()
|
onRefresh()
|
||||||
@@ -84,7 +84,7 @@ fun RefresheableBox(
|
|||||||
|
|
||||||
PullToRefreshBox(
|
PullToRefreshBox(
|
||||||
isRefreshing = isRefreshing,
|
isRefreshing = isRefreshing,
|
||||||
onRefresh = onRefresh,
|
onRefresh = onRefreshWrapped,
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
content = content,
|
content = content,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user