[FIX] 영어 환경 태그 생성 제한 오류 수정#253
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Walkthrough기본 태그 판별 기준을 Changes기본 태그 판별 변경
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/timo-web/app/`[locale]/(main)/settings/_hooks/account/use-settings-profile.ts:
- Around line 61-67: Update the tag mapping logic to call getDefaultTagLabelKey
once, store its result in labelKey, and derive isDefault from whether labelKey
is present. Remove the now-unused isDefaultTagId import while preserving the
existing label translation and fallback behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: b9fb2b4b-465a-41c3-bcb3-0782261fe04e
📒 Files selected for processing (4)
apps/timo-web/app/[locale]/(main)/settings/_hooks/account/use-settings-profile.tsapps/timo-web/hooks/todo-modal/common/use-tag-field.tsxapps/timo-web/schemas/tag/tag-schema.tsapps/timo-web/utils/todo/tag-label.ts
💤 Files with no reviewable changes (1)
- apps/timo-web/schemas/tag/tag-schema.ts
| const isDefault = isDefaultTagId(tag.tagId); | ||
| const labelKey = isDefault ? getDefaultTagLabelKey(tag.tagId) : undefined; | ||
|
|
||
| return { | ||
| id: tag.tagId, | ||
| label: labelKey ? tCommon(`tag.${labelKey}`) : tag.name, | ||
| isDefault: tag.isDefault, | ||
| isDefault, |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
센스 있는 최적화로 성능을 한 스푼 올려볼까요?
현재 isDefault를 구할 때 내부적으로 getDefaultTagLabelKey를 호출하고, 그 값이 참이면 labelKey를 구하기 위해 동일한 함수를 한 번 더 호출하고 있어요.
getDefaultTagLabelKey의 결과를 먼저 변수에 담아두고 이 값을 활용해 기본 태그 여부를 판별하면 중복 연산을 깔끔하게 줄일 수 있습니다. 결괏값 재사용은 연산 낭비를 막는 최적화의 기본 관행이랍니다! (참고: MDN - 함수의 기본)
수정하신 로직도 문제없이 훌륭하게 작동하지만, 이 부분만 살짝 다듬어보면 더 완벽해질 것 같아요. 제안된 코드를 적용하신다면 상단의 isDefaultTagId import도 함께 제거해 주시면 좋습니다. 🚀
✨ 중복 호출을 제거하는 제안
- const isDefault = isDefaultTagId(tag.tagId);
- const labelKey = isDefault ? getDefaultTagLabelKey(tag.tagId) : undefined;
+ const labelKey = getDefaultTagLabelKey(tag.tagId);
+ const isDefault = labelKey !== undefined;
return {
id: tag.tagId,
label: labelKey ? tCommon(`tag.${labelKey}`) : tag.name,
isDefault,📝 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.
| const isDefault = isDefaultTagId(tag.tagId); | |
| const labelKey = isDefault ? getDefaultTagLabelKey(tag.tagId) : undefined; | |
| return { | |
| id: tag.tagId, | |
| label: labelKey ? tCommon(`tag.${labelKey}`) : tag.name, | |
| isDefault: tag.isDefault, | |
| isDefault, | |
| const labelKey = getDefaultTagLabelKey(tag.tagId); | |
| const isDefault = labelKey !== undefined; | |
| return { | |
| id: tag.tagId, | |
| label: labelKey ? tCommon(`tag.${labelKey}`) : tag.name, | |
| isDefault, |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@apps/timo-web/app/`[locale]/(main)/settings/_hooks/account/use-settings-profile.ts
around lines 61 - 67, Update the tag mapping logic to call getDefaultTagLabelKey
once, store its result in labelKey, and derive isDefault from whether labelKey
is present. Remove the now-unused isDefaultTagId import while preserving the
existing label translation and fallback behavior.
Timo Performance ReportBundle Size — timo-web
Lighthouse — timo-web
Image Optimization — timo-web
측정 커밋: |
jjangminii
left a comment
There was a problem hiding this comment.
체크아웃해서 태그 갯수 제한 토스트 확인했습니다~
ISSUE 🔗
close #252
What is this PR? 🔍
영어 환경에서 커스텀 태그가 최대 개수에 도달해도 태그 생성 모달이 열리는 문제를 수정했습니다.
기존에는 태그 목록의
isDefault값을 기준으로 기본 태그와 커스텀 태그를 구분했지만, 태그 목록 응답 타입에는isDefault가 포함되어 있지 않았습니다.따라서 기본 태그의 고정
tagId를 기준으로 기본 태그 여부를 판별하도록 변경했습니다.tagId판별 유틸 추가isDefault제거To Reviewers
isDefault응답 필드 대신 기본 태그 고정 ID(1~4)를 기준으로 판별하도록 변경했습니다.생성 응답에는
isDefault가 존재하므로tagCreateDataSchema에는 유지했고, 목록 응답용tagSchema에서만 제거했습니다.Screenshot 📷
Test Checklist ✔
pnpm lint:webpnpm check-types:web