Skip to content

[#368] LoadingView 띄우는 형태를 LoadingState()로 관리하여 즉시 뜨는게 아닌 일정 시간 딜레이 후 그 동안에도 비동기 로딩 중이면 뜨도록 개선한다#369

Merged
opficdev merged 6 commits intodevelopfrom
refactor/#368-LoadingState
Apr 7, 2026

Conversation

@opficdev
Copy link
Copy Markdown
Owner

@opficdev opficdev commented Apr 7, 2026

🔗 연관된 이슈

📝 작업 내용

📌 요약

  • LoadingState 기본 지연 시간을 .seconds(0.3)로 변경
  • 검색 로딩을 SearchViewModel, TodoListViewModel, LoginViewModel에서 .immediate로 처리하도록 정리
  • 그 외 LoadingState 사용 로딩을 .delayed로 통일

🔍 상세

  • LoadingState 기본 파라미터를 기존 500ms에서 0.3초 표현으로 변경
  • SearchViewModel의 검색 입력 로딩을 즉시 표시하고 기존 디바운스 흐름을 유지하도록 정리
  • TodoListViewModel의 검색 로딩만 .immediate로 적용하고 일반 목록 조회 및 수정 관련 로딩은 .delayed로 분리
  • LoginViewModel의 로그인 로딩을 즉시 표시하도록 변경
  • HomeViewModel, TodayViewModel, TodoDetailViewModel, ProfileViewModel, PushNotificationListViewModel, PushNotificationSettingsViewModel 등의 비검색 .immediate 사용처를 .delayed로 변경

@opficdev opficdev self-assigned this Apr 7, 2026
Copy link
Copy Markdown
Contributor

@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 템플릿 추가, 로딩 지연 시간 조정 및 주요 ViewModel들의 로딩 모드를 .delayed로 변경하여 사용자 경험을 개선합니다. 특히 SearchViewModel과 TodoListViewModel에서 검색 태스크 관리 로직을 강화하고 LoadingState를 통합했습니다. 리뷰에서는 검색 작업 취소 시 cancelSearch()와 defer 블록에서 endLoading이 중복 호출되어 로딩 카운트가 비정상적으로 감소할 수 있는 문제가 지적되었으며, 작업 취소 여부를 확인한 후 로딩을 종료하도록 개선이 필요합니다.

defer { send(.setLoading(false)) }
defer {
self.searchTasks[.request] = nil
self.endLoading(.immediate)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

검색 작업이 취소되었을 때 defer 블록에서 endLoading(.immediate)이 호출되면, cancelSearch()에서 이미 호출된 endLoading과 중복되어 로딩 카운트가 의도치 않게 추가로 감소할 수 있습니다. 이로 인해 새로운 검색이 시작되었음에도 로딩 인디케이터가 조기에 사라지는 현상이 발생할 수 있으므로, 작업이 취소되지 않은 경우에만 호출하도록 수정이 필요합니다.

                        if !Task.isCancelled {
                            self.endLoading(.immediate)
                        }

defer { endLoading(.immediate) }
defer {
self.searchTasks[.request] = nil
self.endLoading(.immediate)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

SearchViewModel과 마찬가지로, 검색 작업 취소 시 defer 블록의 endLoadingcancelSearch() 내의 호출과 중복되어 로딩 상태가 비정상적으로 종료될 위험이 있습니다. 작업 취소 여부를 확인하여 정상 종료 시에만 카운트를 감소시키도록 개선해야 합니다.

                        if !Task.isCancelled {
                            self.endLoading(.immediate)
                        }

@opficdev opficdev merged commit 3392576 into develop Apr 7, 2026
1 check passed
@opficdev opficdev deleted the refactor/#368-LoadingState branch April 7, 2026 06:10
@opficdev opficdev restored the refactor/#368-LoadingState branch April 7, 2026 06:14
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