[#272] Todo를 제거한 후 해당 Todo에 대한 푸시알림 데이터가 일정 시간 그대로 유지되는 이슈를 해결한다#274
[#272] Todo를 제거한 후 해당 Todo에 대한 푸시알림 데이터가 일정 시간 그대로 유지되는 이슈를 해결한다#274
Conversation
opficdev
commented
Mar 15, 2026
- closed Todo를 제거한 후 해당 Todo에 대한 푸시알림 데이터가 일정 시간 그대로 유지되는 이슈를 해결한다 #272
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! 이 풀 리퀘스트는 Todo를 삭제한 후에도 해당 Todo에 대한 푸시 알림 데이터가 일정 시간 동안 그대로 유지되어 사용자에게 혼란을 줄 수 있었던 문제를 해결합니다. Todo 삭제 시 5초의 유예 기간을 두어 사용자가 삭제를 취소할 수 있도록 하는 소프트 삭제 메커니즘을 도입했으며, 이 과정에서 푸시 알림 데이터도 즉시 업데이트되도록 개선했습니다. 핵심 로직은 Firebase Cloud Functions를 통해 구현되어 서버 측에서 안전하고 효율적으로 처리됩니다. Highlights
Changelog
Activity
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은 Todo 삭제 시 잠시 동안 삭제를 취소할 수 있는 기능을 추가하고, 이와 관련된 푸시 알림 데이터가 즉시 반영되지 않는 문제를 해결했습니다. 클라이언트(Swift)에서는 TodoListViewModel을 중심으로 상태 관리를 수정하여 삭제 취소 UI를 구현했고, 백엔드(Firebase Functions)에서는 deletingAt 필드를 이용한 'soft delete'와 지연된 최종 삭제 로직을 추가했습니다. 전체적으로 기능 구현이 잘 이루어졌으며, 몇 가지 유지보수성 및 잠재적 오류 개선을 위한 제안 사항을 코드 리뷰에 남겼습니다.
| state.todos.insert(todo, at: index) | ||
| } | ||
| pendingTask = nil | ||
| return [.undoDelete(todo.id)] |
There was a problem hiding this comment.
undoDelete 사이드 이펙트를 반환하는 것은 올바르지만, 바로 앞의 UI 상태 복원 로직에 잠재적인 버그가 있습니다. if index <= state.todos.count 조건문에서 index가 state.todos.count를 초과하는 경우에 대한 처리가 없습니다. 이 경우 todo 항목이 UI에 다시 표시되지 않게 됩니다. 예를 들어, 삭제 취소 토스트가 표시된 상태에서 목록이 새로고침되어 todos 배열의 크기가 변경되면 발생할 수 있습니다. else 블록을 추가하여 state.todos.append(todo)를 호출하는 것을 고려해 보세요.
| let function = functions.httpsCallable("requestTodoDeletion") | ||
| _ = try await function.call(["todoId": todoId]) | ||
|
|
||
| logger.info("Successfully deleted todo") | ||
| logger.info("Successfully requested todo deletion") | ||
| } catch { | ||
| logger.error("Failed to delete todo", error: error) | ||
| logger.error("Failed to request todo deletion", error: error) | ||
| throw error | ||
| } | ||
| } | ||
|
|
||
| func undoDeleteTodo(todoId: String) async throws { | ||
| guard Auth.auth().currentUser?.uid != nil else { throw AuthError.notAuthenticated } | ||
|
|
||
| logger.info("Undoing todo deletion: \(todoId)") | ||
|
|
||
| do { | ||
| let function = functions.httpsCallable("undoTodoDeletion") | ||
| _ = try await function.call(["todoId": todoId]) |
There was a problem hiding this comment.
Firebase function 이름인 "requestTodoDeletion"과 "undoTodoDeletion"이 문자열로 하드코딩되어 있습니다. 오타의 위험을 줄이고 유지보수성을 높이기 위해, 이 이름들을 별도의 상수로 정의하여 사용하는 것이 좋습니다. 예를 들어, private enum FunctionName { static let requestTodoDeletion = "requestTodoDeletion"; static let undoTodoDeletion = "undoTodoDeletion" } 와 같이 정의하고 사용할 수 있습니다.
| guard let (item, _) = pendingTask else { | ||
| return [] | ||
| } | ||
| pendingTask = nil |
|
|
||
| try { | ||
| await taskRef.set(taskData); | ||
| const todoRef = admin.firestore().doc(`users/${userId}/todoLists/${todoId}`); |