Skip to content

Commit f05cad2

Browse files
committed
[BOOK-364] fix: 알림 설정 Optimistic Update 경쟁 조건 방지
1 parent 7dec07a commit f05cad2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

feature/settings/src/main/kotlin/com/ninecraft/booket/feature/settings/notification/NotificationPresenter.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class NotificationPresenter @AssistedInject constructor(
3333

3434
fun updateNotificationSettings(enabled: Boolean) {
3535
scope.launch {
36+
val prevNotificationEnabled = userRepository.getUserNotificationEnabled()
3637
userRepository.setUserNotificationEnabled(enabled)
3738

3839
userRepository.updateNotificationSettings(enabled)
@@ -52,7 +53,7 @@ class NotificationPresenter @AssistedInject constructor(
5253
navigator.resetRoot(LoginScreen())
5354
},
5455
)
55-
userRepository.setUserNotificationEnabled(!enabled)
56+
userRepository.setUserNotificationEnabled(prevNotificationEnabled)
5657
}
5758
}
5859
}

0 commit comments

Comments
 (0)