Open
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
📌𝘐𝘴𝘴𝘶𝘦𝘴
📎𝘞𝘰𝘳𝘬 𝘋𝘦𝘴𝘤𝘳𝘪𝘱𝘵𝘪𝘰𝘯
📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵
[수정 전]
Screen_recording_20260214_112215.mp4
[수정 후]
Screen_recording_20260214_112451.mp4
💬𝘛𝘰 𝘙𝘦𝘷𝘪𝘦𝘸𝘦𝘳𝘴
문제 상황
요약: 필터 변경 결과가 “사실상 동일”한 케이스에서 빈 화면으로 고정되는 문제
원인 분석
1) ViewModel에서 필터/정렬 변경 시 UI 데이터를 선제적으로 초기화
기존 코드에서 필터/정렬 변경 시 아래처럼 myFeedData를 새 객체로 교체하여 feeds가 즉시 empty가 되었습니다.
applyMyFilter()에서 myFeedData = FeedSourceData()updateMyFeedSort()에서 myFeedData = FeedSourceData(sort = sort)이로 인해 필터/정렬 버튼을 누르는 순간 UI가 Empty 화면으로 전환될 수 있는 구조였습니다.
2) Repository(StateFlow)가 “동일 값”이면 emit하지 않아 UI 복구 트리거가 사라짐
Repository의 MutableStateFlow는 새로운 값이 이전 값과 equals로 동일하면 emit을 하지 않습니다.
실제 로그에서도 아래와 같이 changed=false(동일) 인 케이스가 발생했습니다.
myFeedsFlow.collect { ... }가 실행되지 않아 UI를 다시 채우는 로직이 동작하지 않았습니다.myFeedData.feeds = []상태가 유지되어 Empty 화면에서 복구되지 않았습니다.해결방법
필터/정렬 변경 시 기존 리스트(feeds)를 비우지 않고 유지하며, 다음 요청을 위해 필요한 값만 리셋하도록 수정했습니다.
변경 사항 요약
applyMyFilter():myFeedData = FeedSourceData()로 초기화하던 로직 제거 → feeds 유지 + refreshing 처리updateMyFeedSort(): 동일하게 feeds 유지 + paging reset + refreshing 처리비고(동기화 전략과의 관계)
본 이슈는 "dirty를 언제 서버에 반영할지(동기화 타이밍)"의 문제가 아니라,
UI 상태를 선제적으로 비운 뒤, 동일 결과에서는 Flow emit이 없어 복구되지 않는 UI 상태 관리 문제였습니다!
따라서 데이터가 동일해 emit이 없더라도 UI가 안정적으로 유지되도록 UI 상태 관리를 개선하였습니다.