From 53c97a93bf3608073dc4a4f1d2b5b1d158f7e54d Mon Sep 17 00:00:00 2001 From: Wooyeol Lee Date: Thu, 7 Dec 2023 13:54:41 +0900 Subject: [PATCH 1/2] fix: fix update 3 latest emojis on post after uploading reaction --- .../com/goliath/emojihub/views/components/CustomBottomSheet.kt | 2 ++ 1 file changed, 2 insertions(+) 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..bff9055d 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 @@ -206,6 +206,7 @@ fun CustomBottomSheet ( coroutineScope.launch { bottomSheetState.hide() } + postViewModel.fetchPostList() } } } @@ -221,6 +222,7 @@ fun CustomBottomSheet ( coroutineScope.launch { bottomSheetState.hide() } + postViewModel.fetchPostList() } } } From 08c20cc106a43dce294cac8578ec69f9d6dd9f70 Mon Sep 17 00:00:00 2001 From: Wooyeol Lee Date: Thu, 7 Dec 2023 13:57:04 +0900 Subject: [PATCH 2/2] refactor: fetchMyCreated/Saved EmojiList call on launched effect of BottomSheetContent --- .../emojihub/views/components/CustomBottomSheet.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 bff9055d..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 {