-
Notifications
You must be signed in to change notification settings - Fork 0
dev로 머지 #447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
[FIX/FE] 통계 답해요로 바뀌지 않는 문제 해결
WalkthroughThis change introduces a new optional prop, Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant T as TabBarContainer
participant C as Callback (onSelectedItemChanged)
participant S as StatisticsPage
U->>T: Clicks on a tab
T->>T: Update activeIndex internally
T->>C: Call onSelectedItemChanged(itemId)
C->>S: Update currentTab state (if provided)
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Pro Plan! Simply use the command ✨ Finishing Touches
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for onu-univ ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
frontend/src/domains/admin/pages/statistics/index.tsx (2)
167-167: Remove console.log statement.This appears to be leftover debugging code that should be removed before merging to production.
- console.log(currentTab);
182-182: Consider consolidating tab state management.The component now uses both
onTabItemClickandonSelectedItemChangedto update the samecurrentTabstate. While functionally correct, this creates redundancy and could lead to confusion about which callback is responsible for state updates.Either:
- Use only one callback for state management
- Provide comments explaining why both are needed
- Refactor to separate their responsibilities
<TabBarContainer tabItems={tabItems} - onTabItemClick={(itemId) => setCurrentTab(itemId)} + onTabItemClick={() => {}} // Let onSelectedItemChanged handle state updates onSelectedItemChanged={(itemId) => setCurrentTab(itemId)} contents={() => {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
frontend/src/components/tab-bar/TabBarCotainer.tsx(4 hunks)frontend/src/domains/admin/pages/statistics/index.tsx(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Run Tests
🔇 Additional comments (3)
frontend/src/components/tab-bar/TabBarCotainer.tsx (3)
1-1: LGTM - Proper import inclusion.The
useEffectimport is appropriately added to support the new callback functionality.
15-15: LGTM - Well-typed new prop.The new optional prop is properly typed with a function signature that clearly indicates its purpose.
28-28: LGTM - Good default value implementation.Providing a default empty function is a good practice to prevent potential undefined errors when the prop is not supplied.
| useEffect(() => { | ||
| onSelectedItemChanged(tabItems[activeIndex].itemId); | ||
| }, [activeIndex]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add missing dependencies to useEffect.
The useEffect hook is missing dependencies in its dependency array. It uses tabItems and onSelectedItemChanged inside the effect, but these aren't listed as dependencies.
useEffect(() => {
onSelectedItemChanged(tabItems[activeIndex].itemId);
- }, [activeIndex]);
+ }, [activeIndex, onSelectedItemChanged, tabItems]);Without these dependencies, the effect will use stale closures if the props change, potentially causing bugs.
📝 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.
| useEffect(() => { | |
| onSelectedItemChanged(tabItems[activeIndex].itemId); | |
| }, [activeIndex]); | |
| useEffect(() => { | |
| onSelectedItemChanged(tabItems[activeIndex].itemId); | |
| }, [activeIndex, onSelectedItemChanged, tabItems]); |
📌 작업 내용
📂 주요 변경사항
📑 세부 변경사항
🔗 관련 이슈
✅ 검토 요청사항
Summary by CodeRabbit