fix(search): 현재 시간표 복원 전 초기화 크래시 방지 - #640
Closed
qdrptd wants to merge 2 commits into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
이 PR은 앱 프로세스 복원/초기 갱신 타이밍에 TableRepository.currentTable이 아직 준비되지 않았을 때 SearchViewModel이 checkNotNull로 즉시 접근하며 발생하던 크래시를 방지하기 위해, 검색 화면을 “현재 시간표 로딩” 상태를 포함하도록 구조를 변경합니다.
Changes:
SearchUiState에TableState(Loading/Loaded)를 도입하고,SearchViewModel초기 상태에서currentTable을 강제 검증하지 않도록 변경SearchScreen/검색 바텀시트에서Loading동안 시간표 의존 UI를 그리지 않도록 처리(로딩 인디케이터/플레이스홀더)DayTimePickerSheetContent의 요일 표시를 locale 기반으로 변경하고, 스크린샷 테스트에 영어 프리뷰를 추가
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/java/com/wafflestudio/snutt2/feature/search/SearchViewModel.kt | 초기 currentTable null 가능성을 수용하도록 UI 상태 구조 변경 및 combine 로직 갱신 |
| app/src/main/java/com/wafflestudio/snutt2/feature/search/SearchScreen.kt | TableState.Loading 시 로딩 UI만 노출하고 시간표 의존 UI 렌더링 차단 |
| app/src/main/java/com/wafflestudio/snutt2/feature/search/SearchDialogs.kt | 다이얼로그 렌더링 API를 dialogState 중심으로 단순화 |
| app/src/main/java/com/wafflestudio/snutt2/feature/search/SearchBottomSheetLayout.kt | TableState에 따라 바텀시트 콘텐츠/플레이스홀더를 분기 |
| app/src/main/java/com/wafflestudio/snutt2/feature/lecturedetail/DayTimePickerSheetContent.kt | 요일 문자열 생성 로직을 locale 기반(DayOfWeek.getDisplayName)으로 변경 |
| app/src/screenshotTest/java/com/wafflestudio/snutt2/feature/lecturedetail/DayTimePickerSheetContentScreenshotTest.kt | 영어 locale 스크린샷 프리뷰 케이스 추가 |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
102
to
+107
| combine( | ||
| tableRepository.currentTable.filterNotNull(), | ||
| uiState, | ||
| ::Pair, | ||
| ).take(1).flatMapLatest { (table, state) -> | ||
| if (state.tableState !is SearchUiState.TableState.Loaded) return@flatMapLatest emptyFlow() |
qdrptd
force-pushed
the
fix/search-viewmodel-missing-state
branch
from
August 26, 2026 10:31
56c251e to
3459651
Compare
Collaborator
|
하 결국은 이렇게 갈수밖에 없는건가 |
Collaborator
|
이거 근데, Loading Indicator 가 어울리는지는 잘 모르겠어 차라리 로드될 때까지 splash screen 을 지연시키는 게 맞을 것 같음 |
Collaborator
Author
|
이거 이렇게 하는 거 좀 별론데 |
Collaborator
|
ㅇㅇㅇ 한번 splash 지연했을 때 초기값 null 문제 해소되는지 해보자 (TableRepository 이 사용하는 Date Source 의 초기값 설정 속도를 의도적으로 크게 늘려보는 형태로 테스트 가능할듯) |
Collaborator
Author
|
#643 으로! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 배경
앱 프로세스 복원 또는 초기 데이터 갱신 중
TableRepository.currentTable이 아직 비어 있을 수 있습니다. 기존SearchViewModel은 생성 시currentTable.value를checkNotNull로 즉시 사용했기 때문에, 현재 시간표가 emit되기 전에 Search 탭이 구성되면Required value was null.예외로 앱이 종료될 수 있었습니다.변경 사항
SearchUiState에 현재 시간표 준비 상태를 나타내는TableState를 추가했습니다.Loading: 저장된 현재 시간표가 없거나, Repository가 아직 첫 시간표를 emit하기 전 상태Loaded: 검색 화면의 시간표 식별·표시에 필요한courseBook, 강의 목록, 표시 범위, 표시 옵션, 테마가 모두 준비된 상태SearchViewModel의 초기 상태를TableState.Loading으로 변경하고,currentTable을 동기적으로 강제 검증하던checkNotNull을 제거했습니다.combine은 첫 현재 시간표를 수신하면TableState.Loaded를 구성하도록 변경했습니다.SearchScreen과 검색 바텀시트는TableState.Loading일 때 시간표 의존 UI를 그리지 않습니다.SearchUiState에 유지했습니다.