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

Refactor/FE/#422: 안읽은 사람 수 계산 로직 리팩토링 #423

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

seonye-98
Copy link
Collaborator

🤷‍♂️ Description

  • 안읽은 사람수를 계산하는 로직을 리팩토링 했어요.
  const unreadCount = useCallback(
    (logId: string) => {
      if (chatUnreadSortArray.length === 0) {
        return 0;
      }

      for (let i = 0; i < chatUnreadSortArray.length; i++) {
        if (logId <= chatUnreadSortArray[i][1]) {
          return i === 0 ? 0 : Number(chatUnreadSortArray[i - 1][0]);
        }
      }

      return Number(chatUnreadSortArray[chatUnreadSortArray.length - 1][0]);
    },
    [chatUnread]
  );

📝 Primary Commits

  • 안읽은 사람 수 계산 로직 리팩토링

📷 Screenshots

close #422

Copy link
Member

@navyjeongs navyjeongs left a comment

Choose a reason for hiding this comment

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

리팩토링 좋습니다!

@seonye-98 seonye-98 merged commit 48c4414 into dev Dec 13, 2023
2 checks passed
@seonye-98 seonye-98 deleted the Refactor/FE/#422 branch December 13, 2023 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[Refactor] 안읽은 사람 수 계산 로직 리팩토링
2 participants