diff --git a/android/app/src/main/java/com/goliath/emojihub/views/components/CustomBottomSheet.kt b/android/app/src/main/java/com/goliath/emojihub/views/components/CustomBottomSheet.kt index 329adaa0..c00bf717 100644 --- a/android/app/src/main/java/com/goliath/emojihub/views/components/CustomBottomSheet.kt +++ b/android/app/src/main/java/com/goliath/emojihub/views/components/CustomBottomSheet.kt @@ -75,11 +75,16 @@ fun CustomBottomSheet ( var selectedEmojiUnicode by remember { mutableStateOf("") } LaunchedEffect(selectedEmojiUnicode) { - viewModel.fetchMyCreatedEmojiList() - viewModel.fetchMySavedEmojiList() reactionViewModel.fetchReactionList(postViewModel.currentPostId, selectedEmojiUnicode) } + LaunchedEffect(bottomSheetContent) { + if(bottomSheetContent == BottomSheetContent.ADD_REACTION) { + viewModel.fetchMyCreatedEmojiList() + viewModel.fetchMySavedEmojiList() + } + } + ModalBottomSheet( onDismissRequest = { coroutineScope.launch { @@ -206,6 +211,7 @@ fun CustomBottomSheet ( coroutineScope.launch { bottomSheetState.hide() } + postViewModel.fetchPostList() } } } @@ -221,6 +227,7 @@ fun CustomBottomSheet ( coroutineScope.launch { bottomSheetState.hide() } + postViewModel.fetchPostList() } } }