Skip to content

[#141] PushNotificationListView에서 여러 데이터를 제거 후 다른 뷰로 넘어갔다 돌아오면 지워졌던 데이터가 롤백되는 현상을 해결한다#143

Merged
opficdev merged 3 commits intodevelopfrom
fix/#141-PushNotificationListView-Multiple-Undo-Fail
Feb 26, 2026
Merged

[#141] PushNotificationListView에서 여러 데이터를 제거 후 다른 뷰로 넘어갔다 돌아오면 지워졌던 데이터가 롤백되는 현상을 해결한다#143
opficdev merged 3 commits intodevelopfrom
fix/#141-PushNotificationListView-Multiple-Undo-Fail

Conversation

@opficdev opficdev self-assigned this Feb 26, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @opficdev, 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!

이 PR은 PushNotificationListViewModel에서 알림 삭제 시 발생하던 데이터 롤백 문제를 해결합니다. 사용자가 여러 알림을 삭제한 후 다른 화면으로 이동했다가 돌아올 때, 이전에 삭제된 데이터가 다시 나타나는 현상을 방지하기 위해 보류 중인 삭제 작업 처리 로직을 개선했습니다.

Highlights

  • 이전 보류 중인 삭제 처리: 새로운 알림 삭제 작업이 시작되기 전에 이전에 보류 중이던 삭제 작업을 명시적으로 처리하도록 로직을 추가했습니다. 이는 pendingTask에 저장된 이전 항목이 덮어쓰여져 데이터가 롤백되는 것을 방지합니다.
Changelog
  • DevLog/Presentation/ViewModel/PushNotificationListViewModel.swift
    • deleteNotification 액션 처리 시, 새로운 삭제 작업을 시작하기 전에 기존의 pendingTask에 있던 항목에 대한 삭제 SideEffect를 추가하도록 로직을 수정했습니다.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

PR의 목표인 여러 알림을 연속으로 삭제할 때 발생하던 데이터 롤백 현상을 해결하는 로직은 올바르게 수정되었습니다. 하지만, 새로운 로직에서 발생할 수 있는 잠재적인 버그를 발견했습니다. deleteNotification 액션 처리 중, 삭제하려는 항목이 목록에 없을 경우 이전에 대기 중이던 삭제 작업이 누락될 수 있습니다. 이 부분을 수정하는 것이 좋습니다.

effects.append(.delete(pendingItem))
}
guard let index = state.notifications.firstIndex(where: { $0.id == item.id }) else {
return []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

guard let 구문이 실패하여 else 블록이 실행될 때, 이전에 effects 배열에 추가되었을 수 있는 SideEffect가 무시되고 빈 배열이 반환됩니다. 이로 인해 이전에 대기 중이던 삭제 작업이 실행되지 않는 버그가 발생할 수 있습니다. return [] 대신 return effects를 사용하여, 이전에 추가된 SideEffect가 정상적으로 실행되도록 해야 합니다.

Suggested change
return []
return effects

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

새로운 리뷰를 시작하려면 /gemini review 명령어를 사용해 주세요. 이 스레드에서는 추가적인 답변이 필요하지 않습니다.

@opficdev opficdev merged commit 9b84502 into develop Feb 26, 2026
1 check passed
@opficdev opficdev deleted the fix/#141-PushNotificationListView-Multiple-Undo-Fail branch February 26, 2026 16:31
@opficdev
Copy link
Owner Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이 PR은 PushNotificationListView에서 여러 항목을 연속으로 삭제할 때, 이전에 삭제한 항목이 복원되는 버그를 수정합니다. 새로운 삭제 요청이 들어왔을 때 이전에 대기 중이던 삭제 작업을 즉시 처리하도록 로직을 변경하여 문제를 해결한 점이 좋습니다. 동일한 수정이 TodoListViewModel에도 일관성 있게 적용되어 앱 전반의 안정성을 높였습니다. 또한, AlertTypeToastType을 제거하여 얼럿 및 토스트 관련 코드를 간소화한 리팩토링도 훌륭합니다. 전반적으로 좋은 수정이지만, 상태 관리 측면에서 더 개선할 수 있는 부분에 대해 몇 가지 의견을 남깁니다.

Comment on lines 257 to 264
func setAlert(
_ state: inout State,
isPresented: Bool,
for type: AlertType?
isPresented: Bool
) {
switch type {
case .error:
state.alertTitle = "오류"
state.alertMessage = "문제가 발생했습니다. 잠시 후 다시 시도해주세요."
case .none:
state.alertTitle = ""
state.alertMessage = ""
}
state.alertType = type
state.alertTitle = "오류"
state.alertMessage = "문제가 발생했습니다. 잠시 후 다시 시도해주세요."
state.showAlert = isPresented
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

setAlert 함수가 isPresented 값에 관계없이 항상 alertTitlealertMessage를 설정하고 있습니다. 얼럿이 사라질 때(isPresentedfalse일 때)는 메시지를 설정할 필요가 없으며, 이전 구현처럼 메시지를 비워주는 것이 상태 관리에 더 안전합니다. isPresented 값에 따라 분기하여 처리하도록 수정하는 것을 제안합니다.

    func setAlert(
        _ state: inout State,
        isPresented: Bool
    ) {
        if isPresented {
            state.alertTitle = "오류"
            state.alertMessage = "문제가 발생했습니다. 잠시 후 다시 시도해주세요."
        } else {
            state.alertTitle = ""
            state.alertMessage = ""
        }
        state.showAlert = isPresented
    }

Comment on lines 266 to 272
func setToast(
_ state: inout State,
isPresented: Bool,
for type: ToastType?
isPresented: Bool
) {
switch type {
case .delete:
state.toastMessage = "실행 취소"
case .none:
state.toastMessage = ""
}
state.toastMessage = "실행 취소"
state.showToast = isPresented
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

setToast 함수도 setAlert와 유사하게, isPresented 값에 관계없이 항상 toastMessage를 설정하고 있습니다. 토스트가 사라질 때(isPresentedfalse일 때)는 메시지를 비워주는 것이 상태 관리에 더 좋습니다. 삼항 연산자를 사용하여 코드를 간결하게 수정하는 것을 제안합니다.

    func setToast(
        _ state: inout State,
        isPresented: Bool
    ) {
        state.toastMessage = isPresented ? "실행 취소" : ""
        state.showToast = isPresented
    }

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

안녕하세요. 수석 iOS 개발자입니다. 코드 리뷰를 시작하겠습니다. 이번 PR은 여러 항목 삭제 후 화면 전환 시 데이터가 롤백되는 현상을 수정하였네요. PushNotificationListViewModelTodoListViewModel에서 연속 삭제 시 이전 삭제 대기 항목을 즉시 처리하도록 변경하여 문제를 해결한 점이 인상적입니다. 또한, AlertTypeToastType을 제거하여 코드를 간소화한 리팩토링도 좋습니다. 다만, Alert와 Toast가 사라질 때 관련 상태가 초기화되지 않는 부분이 있어, 이에 대한 수정 제안을 코멘트로 남겼습니다. 전반적으로 훌륭한 수정입니다.

Comment on lines +261 to 263
state.alertTitle = "오류"
state.alertMessage = "문제가 발생했습니다. 잠시 후 다시 시도해주세요."
state.showAlert = isPresented

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Alert가 사라질 때 관련 상태(alertTitle, alertMessage)를 초기화하는 로직이 누락되었습니다. Alert가 다시 표시될 때 이전 메시지가 잠시 보이는 문제를 방지하기 위해 isPresentedfalse일 때 메시지를 비워주는 것이 좋습니다.

Suggested change
state.alertTitle = "오류"
state.alertMessage = "문제가 발생했습니다. 잠시 후 다시 시도해주세요."
state.showAlert = isPresented
state.alertTitle = isPresented ? "오류" : ""
state.alertMessage = isPresented ? "문제가 발생했습니다. 잠시 후 다시 시도해주세요." : ""
state.showAlert = isPresented

Comment on lines +270 to 271
state.toastMessage = "실행 취소"
state.showToast = isPresented

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Toast가 사라질 때 toastMessage를 초기화하는 로직이 누락되었습니다. isPresentedfalse일 때 메시지를 비워주어 상태를 명확하게 관리하는 것이 좋습니다.

Suggested change
state.toastMessage = "실행 취소"
state.showToast = isPresented
state.toastMessage = isPresented ? "실행 취소" : ""
state.showToast = isPresented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant