Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

챌린지 메인 화면 새로고침이 안되던 이슈 해결 #99

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.material.Icon
import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
Expand Down Expand Up @@ -57,6 +58,15 @@ fun ChallengeMainScreen(

val state by viewModel.collectAsState()

LaunchedEffect(Unit) {
viewModel.apply {
getNewChallengeItems()
getChallengingItems()
getTypedChallengeItems()
getTopRankChallengeItems()
}
}

ChallengeMainContent(
state,
onChallengeItemClicked = { challengePreview, isChallenging ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ChallengeMainViewModel(
getTopRankChallengeItems()
}

private fun getNewChallengeItems() = intent {
fun getNewChallengeItems() = intent {
reduce {
state.copy(newChallengePreviewsState = UiState.Loading)
}
Expand All @@ -70,7 +70,7 @@ class ChallengeMainViewModel(

}

private fun getChallengingItems() = intent {
fun getChallengingItems() = intent {
reduce {
state.copy(challengingPreviewsState = UiState.Loading)
}
Expand All @@ -88,7 +88,7 @@ class ChallengeMainViewModel(

}

private fun getTopRankChallengeItems() = intent {
fun getTopRankChallengeItems() = intent {
reduce {
state.copy(typedChallengePreviewsState = UiState.Loading)
}
Expand All @@ -103,7 +103,7 @@ class ChallengeMainViewModel(
}
}

private fun getTypedChallengeItems() = intent {
fun getTypedChallengeItems() = intent {
reduce {
state.copy(typedChallengePreviewsState = UiState.Loading)
}
Expand Down
Loading