Skip to content

🐛 Bug: 이모지 페이지네이션 추가하기#160

Merged
aahreum merged 4 commits intomainfrom
fix/emoji-view
Oct 13, 2025
Merged

🐛 Bug: 이모지 페이지네이션 추가하기#160
aahreum merged 4 commits intomainfrom
fix/emoji-view

Conversation

@aahreum
Copy link
Member

@aahreum aahreum commented Oct 13, 2025

🔗 이슈 번호

✨ 작업한 내용

  • 이모지 페이지네이션 추가하였습니다.

💁 Review Point

  • 이모지 추가할 때마다 낙관적 업데이트로 이모지를 화면에 업데이트 해주고 있는데, 이 부분이 페이지네이션이랑 계속 충돌해서 지금 현 상황에서 해결할 수 있는 방향으로 최대한 수정해봤습니다...
  • 이걸 어떻게 해결해야할 지 잘 모르겠습니다....

💡 참고사항

@vercel
Copy link

vercel bot commented Oct 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
frontend Ready Ready Preview Comment Oct 13, 2025 9:37am

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @aahreum, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 이모지 목록에 페이지네이션 기능을 도입하여, 많은 이모지가 있는 경우에도 성능을 최적화하고 사용자 경험을 향상시키는 것을 목표로 합니다. 기존 이모지 API 호출 방식과 컴포넌트 로직을 페이지네이션에 맞게 전반적으로 수정하였으며, 특히 이모지 추가 시 발생하는 낙관적 업데이트와 페이지네이션 간의 충돌 문제를 해결하는 데 중점을 두었습니다.

Highlights

  • 이모지 페이지네이션 기능 추가: 이모지 목록을 페이지별로 불러오고, '더 보기' 버튼을 통해 다음 페이지를 로드할 수 있도록 구현했습니다.
  • getReactions API 수정: 페이지네이션을 지원하도록 url 파라미터를 추가하고, 다음 페이지 URL(next)을 반환하도록 변경했습니다.
  • EmojiSummary 컴포넌트 개선: 드롭다운에 '더 보기' 버튼을 추가하고, 페이지네이션 데이터를 처리할 수 있도록 업데이트했습니다.
  • useReactions 훅 리팩토링: 페이지네이션 상태(hasNext, goNext)를 관리하고, 업데이트된 getReactions API와 연동하도록 수정했습니다.
  • 낙관적 업데이트 로직 조정: SubHeader에서 이모지 추가 시 낙관적 업데이트 로직을 페이지네이션과 충돌하지 않도록 개선했습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link

🎉 구현한 기능 Preview: https://frontend-j3hsrqe69-fe-19-seongihuns-projects.vercel.app

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

안녕하세요! 이모지 페이지네이션 기능 추가를 위한 수고에 감사드립니다. 전반적으로 페이지네이션 구현을 위해 API 호출, 커스텀 훅, 컴포넌트들을 체계적으로 잘 수정하셨습니다. 특히 useReactions 훅을 통해 페이지네이션 로직을 캡슐화하고, getReactions API를 유연하게 변경하신 점이 인상적입니다.

리뷰에서는 낙관적 업데이트와 페이지네이션 충돌 문제를 더 효과적으로 해결하기 위한 제안을 드렸습니다. 데이터 처리 로직을 UI 컴포넌트에서 데이터 관리 훅으로 옮겨 코드의 역할과 책임을 명확히 분리하는 방향을 제안했습니다. 이 변경을 통해 코드의 유지보수성과 가독성을 높일 수 있을 것입니다.

자세한 내용은 각 파일의 주석을 참고해주세요.

Comment on lines +93 to +95
Array.from(
new Map(reactions.map((item) => [item.emoji, item])).values()
).map((item) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

이모지 중복 제거 로직을 useReactions 커스텀 훅으로 옮겨서 데이터 관리 책임을 일원화하는 것을 제안합니다. EmojiSummary 컴포넌트는 데이터를 표시하는 역할에만 집중하는 것이 더 좋습니다. 이렇게 하면 코드가 더 명확해지고 유지보수가 쉬워집니다. useReactions 훅에서 페이지를 추가로 불러올 때 중복을 제거하는 로직을 추가하면 이 문제를 해결할 수 있습니다.

              reactions.map((item) => {

Comment on lines +55 to +58
return {
reactionsArray: [...prev.reactionsArray, ...result.reactionsArray],
next: result.next,
};
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

페이지네이션으로 다음 이모지 목록을 불러올 때 발생할 수 있는 중복 문제를 해결하고 데이터의 일관성을 유지하기 위해, 새로운 데이터를 추가한 후 중복을 제거하고 다시 정렬하는 로직을 추가하는 것이 좋습니다. Map을 사용하여 이모지 기준으로 중복을 제거하고, count를 기준으로 내림차순 정렬하면 낙관적 업데이트와 페이지네이션이 충돌하는 문제를 해결할 수 있습니다. 이 로직은 EmojiSummary 컴포넌트에서 제거하고 이곳으로 옮겨 데이터 처리를 일원화하는 것이 좋습니다.

          const combinedReactions = [
            ...prev.reactionsArray,
            ...result.reactionsArray,
          ];
          const uniqueReactions = Array.from(
            new Map(combinedReactions.map((item) => [item.emoji, item])).values()
          );
          uniqueReactions.sort((a, b) => b.count - a.count);

          return {
            reactionsArray: uniqueReactions,
            next: result.next,
          };

[setError, setData]
);

const goNext = () => fetchReactions(nextUrl);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

goNext 함수가 useReactions 훅이 다시 렌더링될 때마다 새로 생성됩니다. 이 함수는 SubHeader를 통해 EmojiSummary 컴포넌트의 prop으로 전달되므로, 불필요한 리렌더링을 방지하기 위해 useCallback으로 감싸는 것이 좋습니다.

  const goNext = useCallback(() => fetchReactions(nextUrl), [fetchReactions, nextUrl]);

Copy link
Contributor

@Greensod-96 Greensod-96 left a comment

Choose a reason for hiding this comment

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

확인했습니다. 고생많으셧습니다!~!!@!@@@#!@#$!@#$%!@#@!#!@#%!@#%$

@aahreum aahreum merged commit 83add64 into main Oct 13, 2025
3 checks passed
@aahreum aahreum deleted the fix/emoji-view branch October 13, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

[🐛 Bug] 이모지 페이지네이션 추가하기

2 participants