From 6ecb3c14bfd9495218d8c677eb93c9a906bc080a Mon Sep 17 00:00:00 2001 From: WooJin Kong Date: Mon, 1 Apr 2024 10:38:52 +0900 Subject: [PATCH] fix: Fix pulltorefresh indicator not visible when refresh --- .../kongjak/koreatechboard/ui/main/board/Board.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/kongjak/koreatechboard/ui/main/board/Board.kt b/app/src/main/java/com/kongjak/koreatechboard/ui/main/board/Board.kt index 0aea7331..af043f5d 100644 --- a/app/src/main/java/com/kongjak/koreatechboard/ui/main/board/Board.kt +++ b/app/src/main/java/com/kongjak/koreatechboard/ui/main/board/Board.kt @@ -212,7 +212,6 @@ fun BoardContent( LaunchedEffect(key1 = department.name, key2 = department.boards[page].board) { boardViewModel.getAPI(department.name, department.boards[page].board) - pullToRefreshState.startRefresh() } val uiState by boardViewModel.collectAsState() @@ -225,7 +224,18 @@ fun BoardContent( } LaunchedEffect(key1 = lazyPostList.loadState.append is LoadState.Loading) { - if (lazyPostList.loadState.refresh is LoadState.Loading) return@LaunchedEffect + if (lazyPostList.loadState.append is LoadState.Loading) { + pullToRefreshState.startRefresh() + return@LaunchedEffect + } + pullToRefreshState.endRefresh() + } + + LaunchedEffect(key1 = lazyPostList.loadState.refresh is LoadState.Loading) { + if (lazyPostList.loadState.refresh is LoadState.Loading) { + pullToRefreshState.startRefresh() + return@LaunchedEffect + } pullToRefreshState.endRefresh() }