Conversation
| startTransition(() => { | ||
| router.refresh(); // 서버 컴포넌트들을 다시 렌더링 | ||
| reset(); // 에러 상태 초기화 |
There was a problem hiding this comment.
router.refresh 메서드가 비동기적으로 동작하여, 서버 컴포넌트를 다시 렌더링하지 못하는 문제가 있었어요.
refresh 메서드가 promise를 반환하지 않기 때문에 async await을 사용할 수 없었어요.
그래서 startTransition을 써서 refresh, reset 작업의 우선순위를 뒤로 늦췄어요. refresh 실행한 다음에 reset이 일어난다 까지는 찾지 못했으나, React 내부적으로 refresh가 reset 작업보다 먼저 처리하는 것 같아요.
참고 블로그
startTransition의 콜백 안에 두 메서드 다 넣는 경우도 있고, reset 만 넣는 경우도 있었어요.
There was a problem hiding this comment.
Pull Request Overview
This PR implements comprehensive error handling for mutations across the application, adding specific error code checks and user-facing alert messages. The main addition from PR #145 is the use of startTransition in the error boundary component.
- Added error handlers to mutations that check for specific API error codes and display appropriate user messages
- Created a new error boundary component with
startTransitionfor improved error recovery - Integrated
isApiErrorhelper throughout mutation hooks to type-check errors before handling
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/features/my-page/model/use-update-user-profile-mutation.ts | Added onError handler for duplicate interests (MPR001) and missing member (MEM001) errors |
| src/features/auth/model/use-auth-mutation.ts | Added onError handler for duplicate member registration (DUPLICATE_MEMBER) |
| src/entities/user/model/use-user-profile-query.ts | Added error handling for auto-matching mutation with study application and member existence checks |
| src/entities/review/model/use-review-query.ts | Added onError handler for duplicate reviews (CMM001) and missing study/member (CMM003) |
| app/error.tsx | Created error boundary component with startTransition-wrapped recovery actions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -16,6 +17,13 @@ export const useSignUpMutation = () => { | |||
| { name: string; imageExtension: string } | |||
| >({ | |||
| mutationFn: (data: any) => signUp(data), | |||
There was a problem hiding this comment.
The parameter type is specified as any, which defeats TypeScript's type safety. Define a proper type for the signup data or use the existing types from your API layer.
| mutationFn: (data: any) => signUp(data), | |
| mutationFn: (data: { name: string; imageExtension: string }) => signUp(data), |
☘️ 작업 내용
이전 PR #145 이랑 다른 점은 startTransition 적용한 거 말곤 동일합니다.