Skip to content

Conversation

@le2yunji
Copy link
Contributor

@le2yunji le2yunji commented Dec 2, 2025

🎯 작업 내용

  • 구현한 기능 설명
  • 로딩스피너 컴포넌트 구현
  • 로딩화면 구현
  • 사장님 가게 정보 (가게 등록 전, 후) 페이지, 사장님 공고 등록 페이지, 사장님 공고 상세 페이지에 적용

✅ 체크리스트

  • 코드 리뷰 요청
  • 테스트 완료
  • 문서 업데이트

📸 스크린샷 (선택사항)

2025-12-02.8.52.40.mov

💬 추가 설명

@le2yunji le2yunji self-assigned this Dec 2, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @le2yunji, 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은 사용자 경험을 향상시키기 위해 새로운 로딩 스피너 컴포넌트를 도입하고, 이를 여러 핵심 페이지에 적용합니다. 이를 통해 사용자는 페이지 콘텐츠가 로드되는 동안 명확한 시각적 피드백을 받게 되며, 기존의 단순한 텍스트 기반 로딩 메시지를 대체하여 애플리케이션의 전반적인 반응성과 전문성을 높입니다.

Highlights

  • 로딩 스피너 컴포넌트 구현: 새로운 LoadingSpinner 컴포넌트가 components/common/LoadingSpinner.tsx 파일에 추가되었습니다. 이 컴포넌트는 Tailwind CSS를 사용하여 시각적으로 매력적인 로딩 애니메이션을 제공합니다.
  • 로딩 화면 적용: 구현된 LoadingSpinner 컴포넌트가 사장님 관련 페이지(가게 등록 전/후, 공고 등록, 공고 상세 페이지)에 통합되어 데이터 로딩 중 사용자에게 시각적인 피드백을 제공합니다.
  • 페이지 로딩 로직 개선: 기존 페이지들의 로딩 상태 관리 로직이 개선되어, 데이터 페칭 중 LoadingSpinner를 표시하고, 로딩 완료 후 또는 에러 발생 시 적절한 UI를 렌더링하도록 업데이트되었습니다.
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.

@le2yunji le2yunji added the ✨ Feat 새로운 기능 추가 label Dec 2, 2025
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

이 Pull Request는 로딩 스피너 컴포넌트를 추가하고 여러 페이지에 적용하여 사용자 경험을 개선하는 것을 목표로 합니다. 로딩 상태를 시각적으로 보여주는 것은 좋은 접근입니다. 하지만, 로딩 상태를 처리하는 로직에서 몇 가지 심각한 버그가 발견되었습니다. 특정 페이지에서는 무한 로딩에 빠질 수 있는 문제가 있고, 다른 페이지에서는 useEffect 내에서 JSX를 잘못 반환하여 오류를 발생시키는 코드가 있습니다. 이러한 문제들을 수정해야 안정적인 기능을 제공할 수 있습니다.

Comment on lines 31 to +61
useEffect(() => {
const checkAuth = () => {
const initializePage = async () => {
// 1. 로그인 체크
const userId = localStorage.getItem('userId');
if (!userId) {
router.push('/login');
return;
}
};
checkAuth();
}, [router]);

// 가게 정보 불러오기 (originalHourlyPay 가져오기)
useEffect(() => {
const fetchShopData = async () => {
if (!shopId || typeof shopId !== 'string') return;
// 2. shopId 확인
if (!shopId || typeof shopId !== 'string') {
return;
}

// 3. 가게 정보 불러오기
try {
const shopRes = await shops.getShop(shopId);
if (shopRes?.item?.originalHourlyPay) {
setOriginalPay(shopRes.item.originalHourlyPay);
}
} catch (error) {
console.error('가게 정보 불러오기 실패:', error);
setErrorMessage('가게 정보를 불러오는데 실패했습니다.');
setErrorModalOpen(true);
} finally {
setLoading(false);
}
};

fetchShopData();
}, [shopId]);
initializePage();
}, [router, shopId]);
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

useEffect 내의 로직에 문제가 있어 페이지가 무한 로딩 상태에 빠질 수 있습니다. shopIdrouter.query로부터 아직 제공되지 않았을 때 initializePage 함수가 return되면서 setLoading(false)가 호출되지 않기 때문입니다. 이로 인해 사용자는 계속 로딩 스피너만 보게 됩니다. router.isReady를 사용하여 라우터가 준비되었는지 확인하고, 준비되었음에도 shopId가 없는 경우에만 로딩을 중단하도록 로직을 수정해야 합니다.

  useEffect(() => {
    const initializePage = async () => {
      // 1. 로그인 체크
      const userId = localStorage.getItem('userId');
      if (!userId) {
        router.push('/login');
        return;
      }

      // 2. shopId가 준비될 때까지 기다리거나, 없으면 로딩 종료
      if (!shopId || typeof shopId !== 'string') {
        // 라우터가 준비되었지만 shopId가 없는 경우, 로딩을 중단합니다.
        if (router.isReady) {
          setLoading(false);
        }
        return;
      }

      // 3. 가게 정보 불러오기
      try {
        const shopRes = await shops.getShop(shopId);
        if (shopRes?.item?.originalHourlyPay) {
          setOriginalPay(shopRes.item.originalHourlyPay);
        }
      } catch (error) {
        console.error('가게 정보 불러오기 실패:', error);
        setErrorMessage('가게 정보를 불러오는데 실패했습니다.');
        setErrorModalOpen(true);
      } finally {
        setLoading(false);
      }
    };

    initializePage();
  }, [router, shopId]);

const fetchNotice = async () => {
try {
setLoading(true);
if (loading) return <LoadingSpinner />;
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

useEffect 내부의 비동기 함수 fetchNotice에서 JSX 컴포넌트(LoadingSpinner)를 반환하고 있습니다. useEffect 내부에서 호출되는 함수는 렌더링을 위한 함수가 아니므로 JSX를 반환할 수 없으며, 이는 타입 에러를 발생시킵니다. 또한, 바로 앞 줄에서 setLoading(true)를 호출하고 있어 이 조건문은 항상 참이 됩니다. 로딩 상태에 따른 UI 분기는 컴포넌트의 최상위 return 문에서 처리해야 합니다. 이미 173번째 줄에서 올바르게 처리하고 있으므로, 이 줄은 삭제해야 합니다.

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

Labels

✨ Feat 새로운 기능 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants