[#275] 토스트를 통해 undo 액션이 구현되어 있을 경우 서버사이드로 책임을 이관하도록 개선한다#276
[#275] 토스트를 통해 undo 액션이 구현되어 있을 경우 서버사이드로 책임을 이관하도록 개선한다#276
Conversation
opficdev
commented
Mar 16, 2026
- closed 토스트를 통해 undo 액션이 구현되어 있을 경우 서버사이드로 책임을 이관하도록 개선한다 #275
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 Pull Request는 푸시 알림 및 웹 페이지 삭제 기능의 Undo 로직을 클라이언트에서 서버사이드로 전환하여 시스템의 견고성과 사용자 경험을 향상시키는 것을 목표로 합니다. Firebase Functions를 활용하여 삭제 요청 시 일정 유예 기간을 두어 사용자가 삭제를 취소할 수 있도록 하며, 이 기간이 지나면 데이터가 최종적으로 삭제됩니다. 이를 통해 클라이언트의 복잡성을 줄이고 데이터 일관성을 보장합니다. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이번 PR은 토스트 메시지를 통한 '삭제 실행 취소' 기능의 책임을 클라이언트에서 서버로 성공적으로 이관했습니다. Firebase Functions와 Cloud Tasks를 활용하여 지연 삭제(deferred deletion) 패턴을 구현한 점이 인상적이며, 이를 통해 앱의 안정성과 데이터 정합성이 크게 향상될 것으로 기대됩니다.
전반적으로 훌륭한 개선이지만, 코드의 명확성과 유지보수성을 더욱 높일 수 있는 몇 가지 부분을 발견하여 리뷰 코멘트를 남겼습니다. ViewModel에서의 비동기 처리 로직을 일부 단순화하고, Firebase Functions의 중복 코드를 추상화하는 방안을 제안했습니다. 확인 부탁드립니다.
| case .undoDelete(let notificationId): | ||
| Task { | ||
| do { | ||
| try await undoDeleteUseCase.execute(notificationId) | ||
| send(.fetchNotifications) | ||
| } catch { | ||
| send(.setAlert(isPresented: true)) | ||
| send(.fetchNotifications) | ||
| } | ||
| } |
There was a problem hiding this comment.
undoDelete 사이드 이펙트 처리 시, undoDeleteUseCase.execute가 실패하더라도 send(.fetchNotifications)를 호출하고 있습니다. 삭제 취소에 실패했는데 목록을 다시 불러오면 사용자가 삭제했던 항목이 그대로 사라져 있어 혼란을 줄 수 있습니다. 삭제 취소 실패 시에는 오류 알림만 표시하고, 목록을 다시 로드하지 않는 것이 더 나은 사용자 경험을 제공할 것입니다.
case .undoDelete(let notificationId):
Task {
do {
try await undoDeleteUseCase.execute(notificationId)
send(.fetchNotifications)
} catch {
send(.setAlert(isPresented: true))
}
}| case .toggleRead(let notificationId): | ||
| Task { | ||
| do { | ||
| defer { send(.setLoading(false)) } | ||
| send(.setLoading(true)) | ||
| try await toggleReadUseCase.execute(todoId) | ||
| try await toggleReadUseCase.execute(notificationId) | ||
| } catch { | ||
| send(.setAlert(isPresented: true)) | ||
| } |
There was a problem hiding this comment.
run 함수의 toggleRead 사이드 이펙트 처리부에서 notificationId라는 파라미터명을 사용하고 있지만, 실제로는 reduceByUser에서 item.todoId를 전달하고 있습니다. 이는 코드의 의도를 파악하는 데 혼란을 줄 수 있으므로, 실제 전달되는 값의 의미에 맞게 파라미터명을 todoId로 명확하게 변경하는 것이 좋겠습니다.
case .toggleRead(let todoId):
Task {
do {
defer { send(.setLoading(false)) }
send(.setLoading(true))
try await toggleReadUseCase.execute(todoId)
} catch {
send(.setAlert(isPresented: true))
}
}