Skip to content

✨ Feat: 리스트 페이지 무한 스크롤 기능 추가 및 useInfiniteScroll 훅 롤백#144

Merged
aahreum merged 13 commits intomainfrom
fix/useInfiniteScroll
Oct 13, 2025
Merged

✨ Feat: 리스트 페이지 무한 스크롤 기능 추가 및 useInfiniteScroll 훅 롤백#144
aahreum merged 13 commits intomainfrom
fix/useInfiniteScroll

Conversation

@aahreum
Copy link
Member

@aahreum aahreum commented Oct 13, 2025

🔗 이슈 번호

✨ 작업한 내용

  • 리스트 페이지 가로 무한 스크롤 기능 추가하였습니다.
  • useInfiniteScroll 훅에 ref를 추가하였더니 가로 스크롤, 세로 스크롤에서 정상동작하지 않는 부분들이 계속 발생해서 훅을 다시 이전으로 되돌렸습니다.

💁 Review Point

  • 수정사항 있으시면 말씀해주세요.

@aahreum aahreum added this to the Rolling 프로젝트 milestone Oct 13, 2025
@aahreum aahreum self-assigned this Oct 13, 2025
@aahreum aahreum added the ✨ Feature 기능 추가 label Oct 13, 2025
@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 3:14am

@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은 리스트 페이지에 모바일 환경을 위한 가로 무한 스크롤 기능을 도입하여 사용자 경험을 향상시키는 것을 목표로 합니다. 이를 위해 리스트 컴포넌트 구조를 데스크톱과 모바일로 분리하고, 데이터 로딩 로직을 담당하는 useRollingPaperData 훅을 확장했습니다. 또한, useInfiniteScroll 훅의 안정성을 확보하기 위해 이전에 발생했던 문제를 해결하고 기능을 간소화했습니다.

Highlights

  • 무한 스크롤 기능 추가: 리스트 페이지에 가로 무한 스크롤 기능이 추가되어, 모바일 환경에서 더욱 부드러운 사용자 경험을 제공합니다.
  • useInfiniteScroll 훅 롤백 및 개선: 이전에 ref를 추가하여 발생했던 가로/세로 스크롤 문제를 해결하기 위해 useInfiniteScroll 훅이 이전 상태로 롤백되고, IntersectionObserver를 활용하는 방식으로 간소화되었습니다.
  • 컴포넌트 구조 개편 및 반응형 처리: 기존 LikeSortedRollingPaperRecentSortedRollingPaper 컴포넌트가 제거되고, RollingPaperListContainer가 추가되어 데스크톱(DesktopPaperList)과 모바일(MobilePaperList) 환경에 따라 다른 리스트 컴포넌트를 렌더링하도록 구조가 변경되었습니다. RollingPaperCard 관련 컴포넌트들도 paper-card 디렉토리로 이동되었습니다.
  • useRollingPaperData 훅 확장: useRollingPaperData 훅에 mode 파라미터가 추가되어 데스크톱의 페이지네이션 방식과 모바일의 무한 스크롤 데이터 누적 방식을 모두 지원하도록 기능이 확장되었습니다.
  • 스크롤바 숨김 유틸리티 추가: 모바일 가로 스크롤 시 스크롤바를 숨기기 위한 scrollbar-hide 유틸리티 CSS 클래스가 추가되었습니다.
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-exz47tc31-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

리스트 페이지에 무한 스크롤 기능을 추가하고 반응형 디자인을 개선하는 PR이네요. 데스크탑과 모바일 뷰를 별도 컴포넌트로 분리하고, 데이터 페칭 로직을 useRollingPaperData 훅으로 통합하여 구조를 개선한 점이 좋습니다. 다만, 무한 스크롤 구현과 데이터 처리 로직에 몇 가지 개선할 점이 있어 리뷰를 남깁니다.

Comment on lines 69 to 73
const merged = [...prev.results, ...result.results];
const unique = merged.filter(
(item, idx, arr) => idx === arr.findIndex((t) => t.id === item.id)
);
return { ...result, results: unique };
Copy link
Contributor

Choose a reason for hiding this comment

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

high

데이터를 추가로 불러올 때 중복을 제거하는 로직이 현재 O(n^2)의 시간 복잡도를 가집니다. 리스트가 길어질수록 성능 저하가 발생할 수 있습니다. 또한, findIndex는 첫 번째 요소의 인덱스를 반환하므로, 만약 서버에서 데이터가 업데이트되어 동일한 ID의 아이템이 다시 수신될 경우 이전 데이터가 유지되고 새로운 데이터가 버려질 수 있습니다.

Map을 사용하여 O(n) 시간 복잡도로 중복을 제거하고 항상 최신 데이터를 유지하도록 개선하는 것을 제안합니다.

        const uniqueById = new Map();
        [...prev.results, ...result.results].forEach(item => {
          uniqueById.set(item.id, item);
        });
        const unique = Array.from(uniqueById.values());
        return { ...result, results: unique };

* @param {'desktop' | 'mobile'} [mode='desktop'] - 데이터 로드 모드
* @returns {{
* data: Object | null,
* data: Object[] | null,
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

JSDoc에서 data의 반환 타입을 Object[] | null로 정의하셨는데, 실제로는 API 응답 전체 객체({ count, next, previous, results })가 반환되므로 Object | null이 더 정확한 타입입니다. 문서의 명확성을 위해 수정하는 것이 좋겠습니다.

Suggested change
* data: Object[] | null,
* data: Object | null,

@github-actions
Copy link

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

Copy link
Contributor

@heoc0523 heoc0523 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 13fcaca into main Oct 13, 2025
3 checks passed
@aahreum aahreum deleted the fix/useInfiniteScroll branch October 13, 2025 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 기능 추가

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

[✨ Feature] 롤링페이퍼 리스트 무한 스크롤 기능 추가

2 participants