Skip to content

Conversation

@hyonun321
Copy link
Contributor

@hyonun321 hyonun321 commented Aug 5, 2025

📝 변경 사항

  1. 메인 홈페이지에 canonical 태그 추가
  2. 홈페이지 -> HomePage.tsx로 분리화

🔍 변경 사항 세부 설명

🕵️‍♀️ 요청사항

📷 스크린샷 (선택)

- 따로 컴포넌트로 분리화함 메타데이터와 use client때문
@hyonun321 hyonun321 self-assigned this Aug 5, 2025
@github-actions github-actions bot enabled auto-merge August 5, 2025 02:36
Copy link

@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.

Summary of Changes

Hello @hyonun321, 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!

This pull request focuses on improving the main homepage's search engine optimization by implementing a canonical URL. Additionally, it includes a significant refactoring of the home page's component structure, separating client-side interactivity into a new component to better utilize Next.js's server and client component architecture.

Highlights

  • SEO Enhancement: I've added a canonical link (<link rel="canonical" href="https://snac-app.com/">) to the main homepage (app/page.tsx). This helps search engines understand the preferred version of the page, preventing duplicate content issues and improving SEO.
  • Next.js Component Refactoring: The home page component has been refactored to align with Next.js App Router best practices. All client-side logic and UI previously residing in app/page.tsx have been extracted into a new dedicated client component, app/HomePage.tsx. This allows app/page.tsx to function as a server component, primarily handling metadata and rendering the client component.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 or fill out our survey to provide feedback.

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.

Copy link
Collaborator

@yshls yshls left a comment

Choose a reason for hiding this comment

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

피승완

@github-actions github-actions bot merged commit d2f87b8 into main Aug 5, 2025
2 checks passed
Copy link

@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은 홈페이지에 canonical 태그를 추가하고, 기존 page.tsx의 클라이언트 로직을 HomePage.tsx 컴포넌트로 분리하는 리팩토링을 진행했습니다. 코드 분리는 Next.js 앱 라우터의 권장 패턴을 잘 따르고 있습니다.

리뷰에서는 몇 가지 개선점을 제안했습니다. 주요 내용으로는 useEffect 의존성 배열의 누락으로 인한 버그 수정, API 요청 시 서버 필터링을 활용한 성능 최적화, 디버깅용 콘솔 로그 제거, 그리고 스타일 가이드에 맞는 파일명 규칙 적용 등이 있습니다. 이러한 부분들을 수정하면 코드의 안정성과 효율성을 더욱 높일 수 있을 것입니다.

Comment on lines +186 to +196
const queryString = generateQueryParams({
cardCategory: cardCategory,
sellStatusFilter: 'ALL' as SellStatus,
priceRanges: [priceRange],
highRatingFirst,
size: PAGE_SIZE,
lastCardId,
lastUpdatedAt,
carrier: carrierForQuery,
favoriteOnly: false,
});

Choose a reason for hiding this comment

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

high

현재 API에서 모든 상태의 카드를 가져온 후 클라이언트 측에서 transactionStatuspostView(FAVORITE_POSTS)에 따라 필터링하고 있습니다. 이는 네트워크와 클라이언트 모두에 부담을 주어 비효율적일 수 있습니다.

generateQueryParams 함수는 sellStatusFilterfavoriteOnly 파라미터를 지원하는 것으로 보입니다. 이 파라미터들을 활용하여 서버 측에서 필터링을 수행하도록 수정하면 성능을 개선하고 클라이언트 측 로직을 단순화할 수 있습니다.

제안:

  1. sellStatusFiltertransactionStatus 값을 전달합니다. (TRADING 상태는 백엔드에서 지원하지 않는 경우 클라이언트 필터링을 유지해야 할 수 있습니다.)
  2. postViewFAVORITE_POSTS일 때 favoriteOnlytrue로 설정합니다.

이렇게 변경하면, 이후의 클라이언트 측 필터링 로직(lines 217-222)도 함께 수정되어야 합니다.

      const queryString = generateQueryParams({
        cardCategory: cardCategory,
        sellStatusFilter:
          transactionStatus && transactionStatus !== 'TRADING'
            ? transactionStatus
            : 'ALL',
        priceRanges: [priceRange],
        highRatingFirst,
        size: PAGE_SIZE,
        lastCardId,
        lastUpdatedAt,
        carrier: carrierForQuery,
        favoriteOnly: postView === 'FAVORITE_POSTS',
      });

Comment on lines +251 to +260
}, [
currentPage,
cardPages,
cardCategory,
category,
transactionStatus,
priceRange,
sortBy,
carrier,
]);

Choose a reason for hiding this comment

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

high

데이터를 가져오는 useEffect의 의존성 배열에 postView가 누락되었습니다. postView 필터가 변경될 때 useEffect가 다시 실행되지 않아 데이터가 갱신되지 않는 버그가 발생할 수 있습니다.

또한, carrier는 이 useEffect 내에서 직접 사용되지 않으므로 의존성 배열에서 제거하는 것이 좋습니다. carrierForQuerycategory 상태를 기반으로 생성되고 있습니다.

  }, [
    currentPage,
    cardPages,
    cardCategory,
    category,
    transactionStatus,
    priceRange,
    sortBy,
    postView
  ]);

});

const fullUrl = `${API_BASE}/cards/scroll?${queryString}&_v=${new Date().getTime()}`;
console.log('[요청 URL]', fullUrl);

Choose a reason for hiding this comment

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

medium

개발 중 디버깅을 위해 추가된 것으로 보이는 console.log 구문이 있습니다. 프로덕션 코드에 포함되지 않도록 제거하는 것이 좋습니다. 유사한 로그가 lines 205, 206, 207, 210에도 있습니다.

스타일 가이드에 따라 구조화된 로깅 시스템을 사용하는 것을 권장합니다.1

Style Guide References

Footnotes

  1. 토스에서는 구조화된 로그 형태를 사용합니다. (link)

filteredCards = filterCardsByPostView(filteredCards, postView);

// sortBy에 따라 카드 정렬
filteredCards = sortCards(filteredCards, sortBy);

Choose a reason for hiding this comment

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

medium

API 요청 시 highRatingFirst 파라미터를 통해 서버 측 정렬을 이미 요청하고 있습니다. 그런데 클라이언트 측에서 sortCards 함수를 통해 다시 정렬을 수행하고 있어 중복 작업이 발생할 수 있습니다.

서버에서 반환된 데이터가 이미 원하는 순서로 정렬되어 있다면, 이 클라이언트 측 정렬 로직은 제거하여 성능을 향상시킬 수 있습니다. 만약 서버 측 정렬이 충분하지 않아 (예: 2차 정렬 기준 부재) 클라이언트 정렬이 의도된 것이라면, 코드에 주석으로 그 이유를 명시해주는 것이 좋겠습니다.1

Style Guide References

Footnotes

  1. 코드의 '무엇'이 아닌 '왜'를 설명해야 합니다. (link)

@@ -1,288 +1,12 @@
'use client';
import { Metadata } from 'next';
import HomePage from './HomePage'; // 클라이언트 컴포넌트 분리

Choose a reason for hiding this comment

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

medium

스타일 가이드에 따르면 파일명은 kebab-case를 사용해야 합니다.1 HomePage.tsx 파일명을 home-page.tsx로 변경하는 것을 고려해 보세요. 파일명을 변경하면 여기 import 구문도 함께 수정해야 합니다.

import HomePage from './home-page'; // 클라이언트 컴포넌트 분리

Style Guide References

Footnotes

  1. 파일명은 kebab-case를 사용해야 합니다. (예: user-profile.tsx) (link)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants