Skip to content

refactor: #137/api 함수 에러 처리 & data fetching 시 로딩, 에러 처리#138

Merged
codeit-kkm merged 2 commits intomainfrom
refactor/#130/data-fetching-error-loading
Apr 16, 2025
Merged

refactor: #137/api 함수 에러 처리 & data fetching 시 로딩, 에러 처리#138
codeit-kkm merged 2 commits intomainfrom
refactor/#130/data-fetching-error-loading

Conversation

@hyeonjiroh
Copy link
Owner

#️⃣ Issue Number

#137


📝 요약

  • api 함수들이 에러를 throw 하도록 변경
  • data fetching 시 try-catch-finally 문을 사용하여 로딩, 에러 처리
  • loading 시 Loading... 문구가 나오도록 간단하게 로딩 처리를 해서 데이터를 불러올 때 layout shift가 있는 부분이 있어 수정이 필요합니다.

🛠️ PR 유형

  • 새로운 기능 추가
  • 버그 수정
  • CSS 등 사용자 UI 디자인 변경
  • 코드에 영향을 주지 않는 변경사항(오타 수정, 변수명 변경 등)
  • 코드 리팩토링
  • 주석 추가 및 수정
  • 문서 수정
  • 테스트 추가, 테스트 리팩토링
  • 빌드 부분 혹은 패키지 매니저 수정
  • 파일 혹은 폴더명 수정
  • 파일 혹은 폴더 삭제

@hyeonjiroh hyeonjiroh self-assigned this Apr 16, 2025
@vercel
Copy link

vercel bot commented Apr 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
taskify ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 16, 2025 1:10pm

@github-actions github-actions bot requested review from ARON-Y and codeit-kkm April 16, 2025 13:10
}
};

if (loading) return <p>Loading...</p>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

로딩 상태 표시 좋네요! 다만 단순히 텍스트를 표시하는 대신에 로딩 스피너나 스켈레톤을 넣어서 UI가 자연스럽게 표시되도록 하는 방법도 좋겠어요!

Copy link
Owner Author

Choose a reason for hiding this comment

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

맞아요 우선은 loading 상태 사용을 위해서 임시로 이렇게 해놨는데, 금요일 리팩토링 때 아름님이 말씀하신 것처럼 스켈레톤을 사용하거나 하는 식으로 UI를 바꿔볼 생각입니다!

color: selectedColor,
id,
});
setLoading(true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

저도 이 부분 고민중인 부분이에요..! setLoading(true)와 setLoading(false)가 여러 곳에서 반복적으로 사용되니까 custom hook으로 분리해서 사용하는 방법을 고민하고 있었어요..!

Copy link
Owner Author

Choose a reason for hiding this comment

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

확실히 반복되는 코드가 많더라구요... 커스텀 훅이 있어도 좋겠네요!

Copy link
Collaborator

@codeit-kkm codeit-kkm left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!

@codeit-kkm codeit-kkm merged commit 1599ad7 into main Apr 16, 2025
3 checks passed
@codeit-kkm codeit-kkm deleted the refactor/#130/data-fetching-error-loading branch April 16, 2025 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants