Skip to content

Conversation

@yulrang
Copy link
Contributor

@yulrang yulrang commented Nov 13, 2024

🔖 Issue Ticket

Ticket

✍️ Description

✅ Checklist

PR

  • Branch Convention 확인

    feat/ 피쳐, fix/ 버그 수정, refactor/ 개선

  • Base Branch 확인
  • 적절한 Label 지정
  • Assignee 및 Reviewer 지정

Test

  • 로컬 작동 확인

Summary by CodeRabbit

  • 새로운 기능

    • CrewCardList 컴포넌트에서 이미지 URL 처리 방식 개선.
    • 데이터 목록 구성 로직 단순화.
  • 버그 수정

    • API 호출의 응답 처리 방식 간소화 및 오류 처리 제거.
  • 문서화

    • MyCrewListResponse 인터페이스의 data 속성을 content로 이름 변경하여 일관성 유지.

commit 51cfe2f
Author: Lee Youl <[email protected]>
Date:   Sat Nov 9 11:40:05 2024 +0900

    🐛 Fix: MockData 날짜 형식 수정

commit 7b68352
Author: Lee Youl <[email protected]>
Date:   Sat Nov 9 11:38:06 2024 +0900

    🐛 Fix: 이전날짜 선택 방지, isToday 날짜 비교 수정

commit f101987
Author: Lee Youl <[email protected]>
Date:   Sat Nov 9 11:19:20 2024 +0900

    🐛 Fix: 폼 동작 개선

commit c408058
Author: Lee Youl <[email protected]>
Date:   Sat Nov 9 10:51:40 2024 +0900

    🐛 Fix: isToday 함수 개선, 데이터 한국시간 기준으로 변경

commit 0683f5a
Author: Lee Youl <[email protected]>
Date:   Fri Nov 8 21:49:45 2024 +0900

    🐛 Fix: 버튼 링크로 교체

commit 43cdfa7
Author: Lee Youl <[email protected]>
Date:   Fri Nov 8 21:43:11 2024 +0900

    🚨 Fix: 린트 오류 제거

commit 9657201
Author: Lee Youl <[email protected]>
Date:   Fri Nov 8 21:34:56 2024 +0900

    🐛 Fix: 스크롤바 두개로 보이는 문제 수정

commit 63a8e1c
Author: Lee Youl <[email protected]>
Date:   Fri Nov 8 21:27:25 2024 +0900

    🐛 Fix: 유효성 검사 날짜 선택 오류 수정

commit 80f8554
Author: Lee Youl <[email protected]>
Date:   Fri Nov 8 21:24:46 2024 +0900

    🐛 Fix: 에러상태인데 새로 값 채울 때 에러 해제하기, 리팩토링

commit af9fb91
Author: Lee Youl <[email protected]>
Date:   Fri Nov 8 20:46:00 2024 +0900

    🐛 Fix: 크루 생성시 디테일 페이지로 이동, 리팩토링

commit f1fe204
Author: Lee Youl <[email protected]>
Date:   Fri Nov 8 20:31:17 2024 +0900

    🐛 Fix: 텍스트 수정(약속 잡기 > 약속 만들기)

commit 5cc6746
Author: Lee Youl <[email protected]>
Date:   Fri Nov 8 20:29:52 2024 +0900

    🐛 Fix: 드롭다운 값 선택시 포커스 아웃 되도록 수정
@coderabbitai
Copy link

coderabbitai bot commented Nov 13, 2024

Walkthrough

이 변경 사항은 getCrewList 함수의 오류 처리 메커니즘을 제거하고, 응답 변수의 타입을 명시적으로 정의하여 API 호출의 응답 처리를 간소화합니다. 또한, CrewCardList 컴포넌트에서는 imageUrl 속성을 조건부로 처리하고, crewDataList의 구성 로직을 통합하여 데이터 추출 프로세스를 간소화합니다. 마지막으로, MyCrewListResponse 인터페이스의 data 속성이 content로 이름이 변경되었습니다.

Changes

파일 경로 변경 요약
src/_apis/crew/crew-list.ts getCrewList 함수에서 오류 처리 제거, 응답 변수 타입 명시적 정의, 응답 처리 간소화.
src/components/common/crew-list/crew-card-list.tsx CrewCardList 컴포넌트의 imageUrl 처리 로직 수정, crewDataList 구성 로직 통합 및 간소화.
src/types/crew-card.d.ts MyCrewListResponse 인터페이스의 data 속성을 content로 이름 변경.

Possibly related PRs

Suggested labels

api, pages

Suggested reviewers

  • User850413
  • HaeJungg
  • Rangbyeolang
  • minkyung5x5

🐰 변화의 기쁨을 노래해요,
크루의 리스트가 새로워졌죠.
이미지도 확인하고,
데이터도 쉽게 가져와,
모두 함께 즐겨요,
새로운 모습으로! 🌟

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/_apis/crew/crew-list.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't determine the plugin "react-hooks" uniquely.

  • /node_modules/eslint-plugin-react-hooks/index.js (loaded in ".eslintrc.js")
  • /node_modules/eslint-config-next/node_modules/eslint-plugin-react-hooks/index.js (loaded in ".eslintrc.js » eslint-config-next/core-web-vitals » /node_modules/eslint-config-next/index.js » plugin:react-hooks/recommended")

Please remove the "plugins" setting from either config or remove either plugin installation.

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a8816c8 and efd52d6.

📒 Files selected for processing (3)
  • src/_apis/crew/crew-list.ts (1 hunks)
  • src/components/common/crew-list/crew-card-list.tsx (2 hunks)
  • src/types/crew-card.d.ts (1 hunks)
🔇 Additional comments (3)
src/types/crew-card.d.ts (1)

68-70: 인터페이스 속성 이름 변경이 일관성을 개선했습니다.

MainCrewListResponse와 동일한 패턴을 따르도록 속성 이름을 변경한 것이 좋습니다.

src/components/common/crew-list/crew-card-list.tsx (2)

34-35: 데이터 매핑 로직이 개선되었습니다!

페이지 데이터 매핑 로직이 content 프로퍼티를 일관되게 사용하도록 통합되어 코드가 더 간결해졌습니다. 널 병합 연산자(??)를 사용한 안전한 폴백 처리도 잘 되어있습니다.


66-70: 이미지 URL 처리 로직 검토가 필요합니다.

imageUrl === 'string' 조건은 API에서 기본값이 올바르게 처리되지 않고 있을 가능성을 시사합니다. 임시 해결책으로는 작동하지만, 근본적인 원인 파악이 필요해 보입니다.

다음 스크립트로 API 응답에서 이 패턴이 일관되게 발생하는지 확인해보시기 바랍니다:

백엔드 팀과 협의하여 다음 사항들을 검토해주시기 바랍니다:

  1. API 응답에서 기본값 처리 방식 개선
  2. 이미지 URL이 없는 경우 명시적인 null 또는 빈 문자열 반환

},
);

return response?.data;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

응답 데이터 유효성 검증이 필요합니다.

response?.data를 바로 반환하기 전에 데이터의 유효성을 검증하는 것이 안전합니다.

다음과 같이 데이터 검증을 추가하는 것을 제안드립니다:

-  return response?.data;
+  if (!response?.data) {
+    throw new Error('서버로부터 유효하지 않은 응답을 받았습니다.');
+  }
+  return response.data;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return response?.data;
if (!response?.data) {
throw new Error('서버로부터 유효하지 않은 응답을 받았습니다.');
}
return response.data;

Comment on lines +8 to +19
const response: { data: MainCrewListResponse } = await fetchApi(
`/api/crews/search?keyword=${keyword}&mainLocation=${mainLocation}&mainCategory=${mainCategory}&subCategory=${subCategory}&sortType=${sortType}&page=${page}&size=${size}&sort=${sort}`,
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
);
return response;
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
return undefined;
}
credentials: 'include', // 인증 정보를 요청에 포함
},
);

return response?.data;
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

API 응답 구조가 변경되지 않았습니다.

src/_apis/crew/crew-list.ts 파일의 8-19번째 줄에서 여전히 .data를 사용하고 있습니다. MyCrewListResponse 인터페이스에 따라 datacontent로 변경해야 합니다.

  • src/_apis/crew/crew-list.ts 파일 (8-19번째 줄)
🔗 Analysis chain

API 응답 구조 변경 사항 확인이 필요합니다.

AI 요약에 따르면 MyCrewListResponse 인터페이스에서 datacontent로 변경되었다고 합니다. 이 변경사항이 현재 구현과 일치하는지 확인이 필요합니다.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the interface definition and its usage
ast-grep --pattern 'interface $interface {
  $$$
  content: $type
  $$$
}'

# Check for any remaining uses of the old property name
rg -l "\.data\b" --type ts

Length of output: 635

Comment on lines +8 to +17
const response: { data: MainCrewListResponse } = await fetchApi(
`/api/crews/search?keyword=${keyword}&mainLocation=${mainLocation}&mainCategory=${mainCategory}&subCategory=${subCategory}&sortType=${sortType}&page=${page}&size=${size}&sort=${sort}`,
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
);
return response;
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
return undefined;
}
credentials: 'include', // 인증 정보를 요청에 포함
},
);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

API 호출에서 오류 처리가 누락되었습니다.

API 호출 시 발생할 수 있는 네트워크 오류나 서버 오류에 대한 처리가 없습니다. 사용자 경험 향상을 위해 적절한 오류 처리가 필요합니다.

다음과 같이 오류 처리를 추가하는 것을 제안드립니다:

  async function getCrewList(condition: ConditionTypes, pageable: PageableTypes) {
    const { keyword, mainLocation, mainCategory, subCategory, sortType } = condition;
    const { page, size, sort = ['string'] } = pageable;

+   try {
      const response: { data: MainCrewListResponse } = await fetchApi(
        `/api/crews/search?keyword=${keyword}&mainLocation=${mainLocation}&mainCategory=${mainCategory}&subCategory=${subCategory}&sortType=${sortType}&page=${page}&size=${size}&sort=${sort}`,
        {
          method: 'GET',
          headers: {
            'Content-Type': 'application/json',
          },
          credentials: 'include',
        },
      );
      return response?.data;
+   } catch (error) {
+     console.error('크루 목록을 불러오는 중 오류가 발생했습니다:', error);
+     throw new Error('크루 목록을 불러오는데 실패했습니다.');
+   }
  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const response: { data: MainCrewListResponse } = await fetchApi(
`/api/crews/search?keyword=${keyword}&mainLocation=${mainLocation}&mainCategory=${mainCategory}&subCategory=${subCategory}&sortType=${sortType}&page=${page}&size=${size}&sort=${sort}`,
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
);
return response;
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
return undefined;
}
credentials: 'include', // 인증 정보를 요청에 포함
},
);
async function getCrewList(condition: ConditionTypes, pageable: PageableTypes) {
const { keyword, mainLocation, mainCategory, subCategory, sortType } = condition;
const { page, size, sort = ['string'] } = pageable;
try {
const response: { data: MainCrewListResponse } = await fetchApi(
`/api/crews/search?keyword=${keyword}&mainLocation=${mainLocation}&mainCategory=${mainCategory}&subCategory=${subCategory}&sortType=${sortType}&page=${page}&size=${size}&sort=${sort}`,
{
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
credentials: 'include', // 인증 정보를 요청에 포함
},
);
return response?.data;
} catch (error) {
console.error('크루 목록을 불러오는 중 오류가 발생했습니다:', error);
throw new Error('크루 목록을 불러오는데 실패했습니다.');
}
}

Comment on lines +68 to 70
content: MyCrewList[];
hasNext: boolean;
}
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

일부 관련 컴포넌트들이 아직 'data' 속성을 사용하고 있습니다.

  • src/components/common/review-list/review-card-list.tsx
  • src/components/common/writable-gathering-card/writable-gathering-card-list.tsx
🔗 Analysis chain

관련 컴포넌트들의 업데이트 여부를 확인해주세요.

이 인터페이스를 사용하는 모든 컴포넌트들이 새로운 속성 이름(content)을 올바르게 참조하는지 확인이 필요합니다.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: 이 인터페이스를 사용하는 컴포넌트들을 검색하여 업데이트가 필요한 부분을 확인합니다.

# MyCrewListResponse 타입을 사용하는 파일들을 검색
echo "MyCrewListResponse를 사용하는 파일 검색:"
rg "MyCrewListResponse" --type ts --type tsx

# 이전 속성명 'data'를 여전히 사용하고 있는 코드를 검색
echo "\n이전 속성명 'data'를 사용하는 코드 검색:"
rg "data\?\.pages" --type ts --type tsx

Length of output: 288


Script:

#!/bin/bash
# Description: 이 인터페이스를 사용하는 컴포넌트들을 다시 검색하여 업데이트가 필요한 부분을 확인합니다.

# MyCrewListResponse 타입을 사용하는 파일들을 검색 (.ts, .tsx 파일)
echo "MyCrewListResponse를 사용하는 파일 검색 (ts, tsx):"
rg "MyCrewListResponse" -g "*.ts" -g "*.tsx"

# 이전 속성명 'data'를 여전히 사용하는 코드를 검색 (.ts, .tsx 파일)
echo "\n이전 속성명 'data'를 사용하는 코드 검색 (ts, tsx):"
rg "data\?\.pages" -g "*.ts" -g "*.tsx"

Length of output: 1202

Copy link
Contributor

@minkyung5x5 minkyung5x5 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!!

Copy link
Contributor

@ChoYenii ChoYenii left a comment

Choose a reason for hiding this comment

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

수고 많으셨습니다!

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.

4 participants