Feat(client): 사이드바에 hasJob 데이터 가져오기 및 가이드 조건 수정#296
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough사이드바 컴포넌트의 hasJob 판정을 로컬스토리지 기반에서 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
|
✅ Storybook chromatic 배포 확인: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/client/src/shared/components/sidebar/Sidebar.tsx`:
- Around line 95-98: The effect only opens the guide when conditions become true
but never closes it when conditions change; update the effect (the useEffect
that references hasJobData, isHasJobLoading, guideClosed and calls setGuideOpen)
to set the guide state based on the current conditions (e.g., call
setGuideOpen(Boolean(hasJobData?.hasJob) && !isHasJobLoading && !guideClosed))
so it both opens and closes correctly, and include guideClosed and
isHasJobLoading (and setGuideOpen if your lint rules require) in the effect
dependency array.
| if (!isHasJobLoading && hasJobData?.hasJob && !guideClosed) { | ||
| setGuideOpen(true); | ||
| } | ||
| }, []); | ||
| }, [hasJobData, isHasJobLoading]); |
There was a problem hiding this comment.
가이드 상태를 조건 변화와 양방향으로 동기화하세요.
현재는 조건 충족 시 setGuideOpen(true)만 수행해서, 이후 hasJob이 false로 바뀌거나 닫힘 플래그가 생겨도 열린 상태가 유지될 수 있습니다.
수정 예시
useEffect(() => {
const guideClosed = localStorage.getItem('jobPinGuideClosed') === 'true';
- if (!isHasJobLoading && hasJobData?.hasJob && !guideClosed) {
- setGuideOpen(true);
- }
-}, [hasJobData, isHasJobLoading]);
+ if (isHasJobLoading) return;
+ setGuideOpen(Boolean(hasJobData?.hasJob && !guideClosed));
+}, [hasJobData?.hasJob, isHasJobLoading]);📝 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.
| if (!isHasJobLoading && hasJobData?.hasJob && !guideClosed) { | |
| setGuideOpen(true); | |
| } | |
| }, []); | |
| }, [hasJobData, isHasJobLoading]); | |
| useEffect(() => { | |
| const guideClosed = localStorage.getItem('jobPinGuideClosed') === 'true'; | |
| if (isHasJobLoading) return; | |
| setGuideOpen(Boolean(hasJobData?.hasJob && !guideClosed)); | |
| }, [hasJobData?.hasJob, isHasJobLoading]); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/client/src/shared/components/sidebar/Sidebar.tsx` around lines 95 - 98,
The effect only opens the guide when conditions become true but never closes it
when conditions change; update the effect (the useEffect that references
hasJobData, isHasJobLoading, guideClosed and calls setGuideOpen) to set the
guide state based on the current conditions (e.g., call
setGuideOpen(Boolean(hasJobData?.hasJob) && !isHasJobLoading && !guideClosed))
so it both opens and closes correctly, and include guideClosed and
isHasJobLoading (and setGuideOpen if your lint rules require) in the effect
dependency array.
📌 Related Issues
📄 Tasks
⭐ PR Point (To Reviewer)
기존에는
이렇게 판단하고 있었어요.
다만 localStorage 기반에서 API 방식으로 변경되면서 로직도 함께 수정하게 되었습니다.
지금은
하는 구조로 변경했습니다.
📷 Screenshot
Summary by CodeRabbit
릴리스 노트
개선 사항
스타일