feat: 8주차 첫번째 미션 - #76
Open
kimdoyeon1234 wants to merge 17 commits into
Open
Conversation
yewon20804
reviewed
May 26, 2026
yewon20804
left a comment
Collaborator
There was a problem hiding this comment.
8주차 미션 1 수고하셨습니다 ! useDebounce 훅을 직접 만드실 때 queryKey에 포함해 불필요한 호출 방지 등 잘 처리해주셨습니다 👍 아래 코멘트 확인 부탁드립니다 !
1. SearchPage.tsx — App.tsx에 라우트 미등록
// 현재 (week8/client/src/App.tsx) — SearchPage 누락
import SearchPage from './pages/SearchPage'; // import는 없음
const router = createBrowserRouter([
{
element: <LayoutWrapper />,
children: [
{ path: "/", element: <LpListPage /> },
// { path: "/search", element: <SearchPage /> } ← 없음
],
},
]);
// 수정
import SearchPage from './pages/SearchPage';
{ path: "/search", element: <SearchPage /> },
SearchPage.tsx 파일이 생성되어 있지만 App.tsx의 라우터에 등록되지 않아서 실제로는 접근이 불가능합니다! LpListPage에 검색 기능을 통합한 구조라면 이 파일은 삭제하거나, 별도 페이지로 쓸 거라면 라우트에 추가해주세요 !
2. MyPage.tsx — fetchNextPage() 를 useEffect 없이 렌더 바디에서 직접 호출
// 현재 (week8/client/src/pages/MyPage.tsx)
// 스크롤 감지
if (inView && hasNextPage) fetchNextPage(); // useEffect 없이 직접 호출
// 수정
useEffect(() => {
if (inView && hasNextPage) fetchNextPage();
}, [inView, hasNextPage, fetchNextPage]);
무한스크롤 감지 로직이 useEffect 없이 컴포넌트 렌더에 있어서, inView가 true인 동안 렌더링될 때마다 fetchNextPage가 계속 호출되는 구조입니다 ! useEffect를 사용해서 inView 변화 시점에만 호출되도록 분리하면 조금 더 안정적으로 동작할 것 같아요👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 작업 내용
검색 최적화를 위한 useDebounce 커스텀 훅 구현 및 무한 스크롤 검색 기능 연동
✨ 상세 작업 내용
✅ 체크리스트