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

Hotfix/#218 메들리 기능 이슈 해결 #231

Merged
merged 2 commits into from
Mar 16, 2023
Merged

Conversation

joohaem
Copy link
Member

@joohaem joohaem commented Mar 16, 2023

  • 브랜치명, 브랜치 알맞게 설정
  • Reviewer, Assignees, Label, Milestone, Issue(PR 작성 후에) 붙이기
  • PR이 승인된 경우 해당 브랜치는 삭제하기

📌 내용

  • 메들리 카드 클릭 안 되는 이슈 해결
    • 마우스로 드래그를 하기 위해 mouseDown 할 때부터 화면이 계속 업데이트 됨으로써, 커스텀 훅이 random 함수 계속해서 새롭게 반환시켜줘요. 그래서 클릭 이벤트가 일어나지 않아 프리뷰를 볼 수가 없었어요. 이를 useMemo 로 계속해서 변하지 않게끔 막아주었습니다
  • 그라데이션 index 접근
    • 배열로써 index를 계속해서 탐색하는 것보다(O(n)) 객체에서 index를 찾아 반환(O(1))하는 방식이 효율적일 것 같아 수정하였습니다.

@joohaem joohaem requested a review from NYeonK March 16, 2023 17:15
@joohaem joohaem self-assigned this Mar 16, 2023
@joohaem joohaem linked an issue Mar 16, 2023 that may be closed by this pull request
7 tasks
@joohaem joohaem linked an issue Mar 16, 2023 that may be closed by this pull request
7 tasks
@joohaem joohaem merged commit d196c8c into release/1.3 Mar 16, 2023
@joohaem joohaem deleted the hotfix/#218-medley branch March 16, 2023 17:16
Copy link
Contributor

@NYeonK NYeonK left a comment

Choose a reason for hiding this comment

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

오빠 체고👍👍 보고 배워서 다음에는 이슈없는 알찬 코드를 만들어볼게요😆😎
고생했어용✨✨

src/util/main/medleyGradation.ts Show resolved Hide resolved
@@ -7,9 +8,10 @@ import { PiickleSWRResponse } from "../../../types/remote/swr";

export function useMedleyLists() {
const { data, error } = useSWR<PiickleSWRResponse<MedleyCard[]>>(`${PATH.MEDLEY}`, realReq.GET_SWR);
const randomMedleyLists = useMemo(() => data?.data.data.sort(() => Math.random() - 0.5), [data]);
Copy link
Contributor

Choose a reason for hiding this comment

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

궁금한게 있어요😵 이 코드는 data가 변할 때마다, 랜덤함수를 반환하라는 거죠?!
새로고침할 때랑, 카드뷰 들어갔다 나오면 메들리 순서가 변경되는데
data는 구롬 언제 바뀌는지에 대한 코드가 어디있는지 아시나용?-?

Copy link
Member Author

Choose a reason for hiding this comment

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

@NYeonK
swr에서 언제 데이터가 revalidate 되는지 살펴보면 될 것 같아요!
살펴보고 저도 알려주세요 !!

@NYeonK
Copy link
Contributor

NYeonK commented Mar 17, 2023

시간복잡도도 생각하는 그,, 증맬루 멋있다,,⭐

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

Successfully merging this pull request may close these issues.

[ Main ] 메인 페이지 메들리 기능 구현
2 participants