Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] 코스 발견 / 추천 코스 정렬 기능 #313

Closed
wants to merge 35 commits into from

Conversation

leeeha
Copy link
Member

@leeeha leeeha commented Jan 16, 2024

📌 개요

✨ 작업 내용

이슈에 자세한 내용 기록해두었습니다! 이해가 안 되는 부분이 있다면 편하게 질문해주세요!

✨ PR 포인트

다음 페이지 요청할 때마다 추천 코스 한 페이지 전체가 notify 되면서 깜박이는 이슈,,,, 이것도 꼭 개선이 필요해보입니다!

좋은 방법 떠오르시면 언제든 피드백 부탁드려요 🥹 🙏

leeeha added 30 commits January 6, 2024 16:01
- 어댑터가 초기화 되지 않은 상태에서, 항목 추가를 위해 어댑터의 함수를 호출하려고 하면 not initialization 런타임 에러 발생함!
…github.com/Runnect/Runnect-Android into feature/feat-recommend-course-sort

# Conflicts:
#	app/src/main/java/com/runnect/runnect/presentation/discover/DiscoverFragment.kt
…into feature/fix-multiview-recyclerview-loading

# Conflicts:
#	app/src/main/java/com/runnect/runnect/presentation/discover/DiscoverViewModel.kt
- 멀티뷰 어댑터에서 notifyItemInserted 함수를 호출하면, 해당 위치에 있는 내부 리사이클러뷰는 다시 바인딩 되며 아이템 데코를 누적해서 적용하게 된다.
- 따라서, 외부 리사이클러뷰 어댑터의 notify 함수에 의해 내부 리사이클러뷰가 재바인딩 되더라도, 아이템 데코레이션은 한번만 적용되도록 코드를 작성하였다.
…github.com/Runnect/Runnect-Android into feature/feat-recommend-course-sort

# Conflicts:
#	app/src/main/java/com/runnect/runnect/domain/entity/DiscoverMultiViewItem.kt
#	app/src/main/java/com/runnect/runnect/presentation/discover/DiscoverFragment.kt
#	app/src/main/java/com/runnect/runnect/presentation/discover/DiscoverViewModel.kt
#	app/src/main/java/com/runnect/runnect/presentation/discover/adapter/multiview/DiscoverMultiViewAdapter.kt
#	app/src/main/java/com/runnect/runnect/presentation/discover/adapter/multiview/DiscoverMultiViewHolderFactory.kt
@leeeha leeeha added 하은 🐰 하은 담당 FEAT ✨ 새로운 기능 구현 labels Jan 16, 2024
@leeeha leeeha requested review from dongx0915, sxunea and unam98 January 16, 2024 08:16
@leeeha leeeha self-assigned this Jan 16, 2024
Copy link
Contributor

@Larry7939 Larry7939 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다 😀

다음 페이지 요청할 때마다 추천 코스 한 페이지 전체가 notify 되면서 깜박이는 이슈,,,, 이것도 꼭 개선이 필요해보입니다!
좋은 방법 떠오르시면 언제든 피드백 부탁드려요 🥹 🙏
ㄴ 이 이슈는 리사이클러뷰 어댑터를 구현할 때 ListAdapter를 사용하면 해결할 수 있을 것 같아요. 데이터 갱신을 위해 notifyDataSetChanged를 사용하면 모든 아이템을 다시 로드하기 때문에 데이터 셋이 크다면 성능 문제가 발생할 수 있어요.
대신 ListAdapter의 submitList를 사용하면 DiffUtil로 데이터 변경을 감지할 수 있어서 성능 이슈를 어느정도 개선할 수 있을 것 같아요!

}

is UiStateV2.Failure -> {
context?.showSnackbar(
Copy link
Contributor

Choose a reason for hiding this comment

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

requireContext를 사용해보시는 건 어떨까요?

Copy link
Member Author

Choose a reason for hiding this comment

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

안녕하세요 지훈님! 리뷰 남겨주셔서 감사합니다 😄

requireContext를 사용하지 않은 이유는 여기 노션 문서를 참고해주세요!

@leeeha
Copy link
Member Author

leeeha commented Jan 23, 2024

@Larry7939 notifyDataSetChanged() 함수는 현재 사용하고 있지 않습니다!

다음 페이지 요청 시 추천 코스 리스트 한 페이지가 전체 갱신되었던 이유는, 현재 코스 발견 화면이 중첩 리사이클러뷰 구조로 되어 있어서

외부 리사이클러뷰 어댑터에서 notifyItemChanged(recommendPosition) 함수를 호출하면, 내부에 있는 추천 코스 리사이클러뷰가 다시 바인딩 되기 때문입니다!

내부가 아닌 외부 리사이클러뷰에서 notify 함수를 호출한 이유는, 내부 리사이클러뷰에서 notify를 하면 높이가 확장되지 않는 문제가 있었기 때문입니다.

그런데, 저번주 토욜에 동현님께서 해당 이유가 추천 코스 리사이클러뷰에 setHasFixedSize(true) 함수를 설정해서 그런 거 같다는 의견을 주셨고 실제로 그 원인이 맞았습니다!!!

#309 PR에 관련 로직을 수정하여 푸시해뒀으니 참고해주세요 :)

@leeeha
Copy link
Member Author

leeeha commented Jan 23, 2024

마라톤, 추천 코스 로직이 많이 변경되어서 해당 pr은 close하고 별도 브랜치에서 다시 올리겠습니다!

@leeeha leeeha closed this Jan 23, 2024
@Larry7939
Copy link
Contributor

아하 그런 히스토리가 있었군요 확인해보겠습니다!👍👍
정리해주셔서 감사해요 하은님~!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FEAT ✨ 새로운 기능 구현 하은 🐰 하은 담당
Projects
Development

Successfully merging this pull request may close these issues.

[FEAT] 코스 발견 / 추천 코스 정렬 기능
2 participants