fix: QA 3์ฐจ#178
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Walkthrough๋ก๋ฉ ์คํผ๋์ ๋ชจ๋ฌ ์ค๋ฒ๋ ์ด์ ๊ฐ๋ก ํญ ์ ํ ๋ฐ ์ค์ ์ ๋ ฌ์ ๋์
ํ๊ณ , UserProfileItem์ Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as ์ฌ์ฉ์
participant I as UserProfileItem
participant R as Router
U->>I: ํ๋กํ ํด๋ฆญ
alt isMyself == true
I->>R: navigate("/myfeed/{userId}")
else isMyself == false
I->>R: navigate("/otherfeed/{userId}")
end
sequenceDiagram
autonumber
actor U as ์ฌ์ฉ์
participant P as SearchBook ํ์ด์ง
participant S as LoadingSpinner
U->>P: ํ์ด์ง ์ง์
/ ๊ฒ์
P->>P: isLoading = true
P->>S: render(fullHeight=true, size="large", message="์ฑ
์ ๋ณด ๋ถ๋ฌ์ค๋ ์ค...")
note right of S: ์ค์ ์ ๋ ฌ ๋ฐ ํญ ์ ์ฝ ํฌํจ๋\nํ๋ ์ ํ
์ด์
๋ณ๊ฒฝ
sequenceDiagram
autonumber
actor U as ์ฌ์ฉ์
participant PF as PostFooter
participant SP as SavePage
participant API as ์๋ฒ
U->>PF: ์ ์ฅ(ํ ๊ธ) ํด๋ฆญ
PF->>API: save/unsave ์์ฒญ
API-->>PF: ์๋ต (isSaved)
PF->>PF: saved ์ํ ๊ฐฑ์
PF->>SP: onSaveToggle(feedId, newSaveState) [์ ํ์ ์ฝ๋ฐฑ]
alt newSaveState == false
SP->>SP: savedFeeds์์ ํญ๋ชฉ ์ ๊ฑฐ / savedBooks ์ฌ๋ก๋ฉ ๊ฐ๋ฅ
else newSaveState == true
SP->>SP: ๋ก์ปฌ ์ํ์ ์ถ๊ฐ
end
Estimated code review effort๐ฏ 3 (Moderate) | โฑ๏ธ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip ๐ Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ๐ Recent review detailsConfiguration used: CodeRabbit UI ๐ก Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. ๐ Files selected for processing (1)
๐ง Files skipped from review as they are similar to previous changes (1)
โจ Finishing Touches
๐งช Generate unit tests
๐ชง TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
๐งน Nitpick comments (7)
src/types/follow.ts (1)
9-9: isMyself ํ๋ ๋งคํ ๊ฒ์ฆ ๋ฐ ํ์ ์์ ์ ์API ํธ์ถ๋ถ์์ response.data.followers/followings๋ฅผ ๊ทธ๋๋ก FollowData[]๋ก ์ฌ์ฉํ๋ฉฐ, ๋ณ๋ ๋งคํ์ด๋ ๊ธฐ๋ณธ๊ฐ ํ ๋น ์์ด
isMyself={user.isMyself}ํํ๋ก ๋๊ธฐ๊ณ ์์ต๋๋ค.
์ด ๊ฒฝ์ฐ ๋ฐฑ์๋๊ฐ isMyself๋ฅผ ๋๋ฝํ๋ฉดundefined๊ฐfalse๋ก ๊ฐ์ฃผ๋ ์ ์์ต๋๋ค.๊ฒํ ๋ฐ ์ ์:
- src/types/follow.ts
โขisMyself๊ฐ ํญ์ ๋ฐํ๋๋ค๋ฉด optional(?)์ ์ ๊ฑฐํ์ฌ required๋ก ๋ณ๊ฒฝ- src/pages/feed/FollowerListPage.tsx (๋๋ API ๋ ์ด์ด)
โข ๋งคํ ์ ๊ธฐ๋ณธ๊ฐ ํ ๋น:โข ๋๋ ์ปดํฌ๋ํธ์ ์ ๋ฌํ๊ธฐ ์ ๊ฐ๋ ์ถ๊ฐconst userData = (response.data as { followers: FollowData[] }).followers.map(f => ({ ...f, isMyself: f.isMyself ?? false, }));์ ๋ฐฉ์ ์ค ์ ์ ํ ๋ฐฉํฅ์ผ๋ก ๋ฐ์ ๋ถํ๋๋ฆฝ๋๋ค.
src/components/common/LoadingSpinner.tsx (2)
27-31: fullHeight์ผ ๋ ๋ฐฐ๊ฒฝ์ด ์์์ผ๋ก โ๋ ํฐ๋ฐ์คโ์ฒ๋ผ ๋น์ด ๋ณด์ผ ์ ์์ต๋๋ค. fullHeight ์์๋ ๊ฐ๋ก๋ ๋ทฐํฌํธ ์ ์ฒด๋ฅผ ๋ฎ๋ ๊ฒ ์์ ํฉ๋๋ค.ํ์ฌ ์ปจํ ์ด๋์ max/min-width์ ๊ฐ์ด๋ฐ ์ ๋ ฌ์ด ํญ์ ์ ์ฉ๋๊ธฐ ๋๋ฌธ์, fullHeight=true๋ก ์ ์ฒด ํ๋ฉด ๋ก๋ฉ์ ์๋ํ ๊ฒฝ์ฐ์๋ ๊ฐ๋ก๋ 767px๋ง ์น ํด์ง๊ณ ์์์ด ๋น์ด ๋ณด์ผ ์ ์์ต๋๋ค(ํนํ ๋ฐ์คํฌํฑ ํญ์์ ๋ ๋๋๋ฌ์ง). fullHeight์ผ ๋๋ง width: 100vw๋ก ์ ํํ๋๋ก ์กฐ๊ฑด๋ถ ์คํ์ผ์ ๊ถ์ฅํฉ๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ์์ ํ๋ฉด ์๋์ ๋ง๊ฒ ๋์ํฉ๋๋ค.
- width: 100%; - max-width: 767px; - min-width: 320px; - margin: 0 auto; - justify-content: center; + ${({ fullHeight }) => + fullHeight + ? ` + width: 100vw; + margin: 0; + ` + : ` + width: 100%; + max-width: 767px; + min-width: 320px; + margin: 0 auto; + `} + justify-content: center;
27-30: ๋งค์ง ๋๋ฒ(767, 320) ๋ฐ๋ณต ์ฌ์ฉ ์ต์ํ ์ ์Modal.styles.ts ๋ฑ ๋ค๋ฅธ ์ปดํฌ๋ํธ์์๋ ๋์ผํ 767/320 ํญ ์ ์ฝ์ ์ฌ์ฉํ๊ณ ์์ต๋๋ค. ํ ๋ง(์: theme.breakpoints ๋๋ layout.containerMaxWidth)๋ก ์์ํํด ์ค๋ณต์ ์ค์ด๋ฉด ์ ์ง๋ณด์์ฑ์ด ์ฌ๋ผ๊ฐ๋๋ค.
src/pages/feed/FollowerListPage.tsx (2)
138-139: isMyself ์ ๋ฌ ์ถ๊ฐ๋ ์ ์ ํฉ๋๋ค. ๋ค๋ง undefined ๋๋น ๋ช ์์ ๋ถ๋ฆฌ์ธ ์บ์คํ ์ ๊ถ์ฅํฉ๋๋ค.API๊ฐ isMyself๋ฅผ ์ ํ์ ์ผ๋ก ์ค ์ ์๋ค๋ฉด, ์๋๋ฅผ ๋ช ํํ ํ๊ธฐ ์ํด ๋ถ๋ฆฌ์ธ ์บ์คํ ์ ์ ์ํฉ๋๋ค.
- isMyself={user.isMyself} + isMyself={!!user.isMyself}
30-37: ๋ฌดํ ์คํฌ๋กค์์ ์ค๋ณต ์์ฒญ ๊ฐ๋ฅ์ฑ: loadUserList์ loading ํด๋ก์ ๊ฐ stale์ผ ์ ์์ต๋๋ค.useCallback์ deps์ loading์ด ์์ด์, ๋น ๋ฅด๊ฒ ์คํฌ๋กค๋ ๋ ๋์ผ ์ธ์คํด์ค์ loadUserList๊ฐ ์ด์ ๋ ๋์ loading=false ์ํ๋ฅผ ๊ณ์ ์ฐธ์กฐํด ์ค๋ณต ํธ์ถ์ด ๋ฐ์ํ ์ ์์ต๋๋ค. in-flight ref ๊ฐ๋๋ฅผ ์ถ๊ฐํ๋ ๋ฐฉ์์ ๊ถ์ฅํฉ๋๋ค.
์ ์ฉ diff(์ ํ๋ ๋ฒ์ ๋ด ๋ณ๊ฒฝ):
const loadUserList = useCallback( async (cursor?: string) => { - if (loading) return; + if (loading || isFetchingRef.current) return; try { setLoading(true); + isFetchingRef.current = true; setError(null); let response; @@ } finally { - setLoading(false); + setLoading(false); + isFetchingRef.current = false; } }, [type, userId], );๋ฒ์ ๋ฐ ์ถ๊ฐ ์ฝ๋(์ฐธ๊ณ ):
// ์๋จ import์ useRef ์ถ๊ฐ // import { useState, useEffect, useCallback, useRef } from 'react'; // ์ํ ์ ์ธ ๊ทผ์ฒ์ ์ถ๊ฐ const isFetchingRef = useRef(false);Also applies to: 87-89
src/components/feed/UserProfileItem.tsx (2)
70-74: isMyself๊ฐ undefined์ผ ๋๋ ๋ช ํํ ์ฒ๋ฆฌ๋๋๋ก ๋ถ๋ฆฌ์ธ ์บ์คํ ์ ๊ถ์ฅํฉ๋๋ค.ํ์ฌ๋ ๋์์๋ ๋ฌธ์ ์์ง๋ง, ์๋๋ฅผ ์ฝ๋์ ๋๋ฌ๋ด๋ ์ธก๋ฉด์์ ์ ํธ๋ฉ๋๋ค.
- {type === 'followlist' && !isMyself && ( + {type === 'followlist' && !Boolean(isMyself) && ( <div className="followbutton" onClick={toggleFollow}> {followed ? '๋ฑ ์ทจ์' : '๋ฑ ํ๊ธฐ'} </div> )}
34-56: ํ๋ก์ฐ ํ ๊ธ ์ค๋ณต ํด๋ฆญ ๋ฐฉ์ง(UX ์์ ํ) ์ ์์ฐ์ ํด๋ฆญ ์ ์ค๋ณต ์์ฒญ์ด ๋ฐ์ํ ์ ์์ต๋๋ค. ๊ฐ๋จํ ๋ก์ปฌ ๋ก๋ฉ ์ํ๋ก ๋ฐฉ์งํ๋ฉด UX์ ์์ ์ฑ์ด ๊ฐ์ ๋ฉ๋๋ค.
์ ํ๋ ๋ฒ์ ๋ด ๋ณ๊ฒฝ:
const toggleFollow = async (e: React.MouseEvent) => { e.stopPropagation(); - try { + if (isToggling) return; + setIsToggling(true); + try { const response = await postFollow(userId, !followed); @@ - } catch (error) { + } catch (error) { console.error('ํ๋ก์ฐ/์ธํ๋ก์ฐ ์คํจ:', error); - } + } finally { + setIsToggling(false); + } };- <div className="followbutton" onClick={toggleFollow}> + <div + className="followbutton" + onClick={toggleFollow} + aria-disabled={isToggling} + style={{ pointerEvents: isToggling ? 'none' : 'auto', opacity: isToggling ? 0.6 : 1 }} + > {followed ? '๋ฑ ์ทจ์' : '๋ฑ ํ๊ธฐ'} </div>๋ฒ์ ๋ฐ ์ถ๊ฐ ์ฝ๋(์ฐธ๊ณ ):
// ์ํ ์ ์ธ๋ถ ๊ทผ์ฒ์ ์ถ๊ฐ const [isToggling, setIsToggling] = useState(false);Also applies to: 71-73
๐ Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
๐ก Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
๐ Files selected for processing (7)
src/components/common/LoadingSpinner.tsx(1 hunks)src/components/feed/UserProfileItem.tsx(2 hunks)src/components/group/Modal.styles.ts(1 hunks)src/pages/feed/FollowerListPage.tsx(1 hunks)src/pages/searchBook/SearchBook.tsx(1 hunks)src/types/follow.ts(1 hunks)src/types/user.ts(1 hunks)
๐งฐ Additional context used
๐งฌ Code Graph Analysis (1)
src/components/feed/UserProfileItem.tsx (2)
src/types/user.ts (1)
UserProfileItemProps(3-14)src/stores/usePopupStore.ts (1)
usePopupStore(67-73)
๐ Additional comments (4)
src/types/user.ts (1)
13-13: UserProfileItemProps: isMyself ๊ณ์ฝ ๋ฐ ๊ธฐ๋ณธ๊ฐ ์ฒ๋ฆฌ ํ์ธ ํ์
- ๊ธฐํ ํ์ธ
followlist ๋ชจ๋์์๋!isMyself์ฒดํฌ๋ก ํ๋ก์ฐ ๋ฒํผ์ ์จ๊ธฐ๊ณ ์์ง๋ง, followerlist ๋ชจ๋์๋ ๋ณ๋ ์ ์ฑ ์ด ์์ต๋๋ค.
โ ๊ธฐํ์ followerlist์์๋ ์๊ธฐ ์์ ์ธ ๊ฒฝ์ฐ UI(ํ์ดํ ํด๋ฆญยท์์น ๋ ธ์ถ ๋ฑ)์ ์ ํ์ด ํ์ํ์ง ํ์ธ ๋ถํ๋๋ฆฝ๋๋ค.- boolean ๋ณด์ฅ
isMyself?: boolean์ด๋ฏ๋ก undefined๊ฐ ๋ค์ด์ฌ ์ ์์ต๋๋ค.
โUserProfileItem์ปดํฌ๋ํธ props ๋์คํธ๋ญ์ฒ๋ง ์isMyself = false๋ํดํธ ํ ๋น ๋๋ ๋ถ๊ธฐ ์!!isMyself๋ณํ์ผ๋ก ํญ์ boolean์ด ๋๋๋ก ์ฒ๋ฆฌํด์ฃผ์ธ์.[src/components/feed/UserProfileItem.tsx ๋ผ์ธ 20โ21]:
// ๋ณ๊ฒฝ ์ ({ userId, isLast, type, isMyself }: UserProfileItemProps) // ๋ณ๊ฒฝ ์์ ({ userId, isLast, type, isMyself = false }: UserProfileItemProps)src/pages/searchBook/SearchBook.tsx (1)
241-241: ๋ก๋ฉ UX ๊ฐ์ LGTM์ฌ์ด์ฆ๋ฅผ ํค์ฐ๊ณ ๋ฉ์์ง๋ฅผ ์ถ๊ฐํด ํผ๋๋ฐฑ์ด ๋ช ํํด์ก์ต๋๋ค. ์ปดํฌ๋ํธ ๋ณ๊ฒฝ ์์ด ์๋น ์ธก์์๋ง ๊ฐ์ ํ ์ ๋ ์ข์ต๋๋ค.
src/pages/feed/FollowerListPage.tsx (1)
52-58: isMyself ํ๋ ํด๋ผ์ด์ธํธ ๋งคํ/API ์ ๊ณต ์ฌ๋ถ ํ์ธ ํ์ํ์ฌ
getFollowerList/getFollowingList์๋ต์ ๊ทธ๋๋กFollowData[]๋ก ์ฌ์ฉํ๋ฉฐ, ํด๋ผ์ด์ธํธ์์isMyself๋ฅผ ๋ณ๋ ํ ๋นํ๋ ๋ก์ง์ด ์์ต๋๋ค. ์ด ๊ฒฝ์ฐ:
- ํ๋ก์ ๋ชฉ๋ก์์ ๋ณธ์ธ ํด๋ฆญ ์
/otherfeed๋ก ์๋ชป ๋ผ์ฐํ- (ํฅํ) ๋ค๋ฅธ ์ ์ ์ ํ๋ก์ ์กฐํ ์ ๋ณธ์ธ ์ฌ๋ถ์ ๋ฐ๋ฅธ ๋ฒํผ ์จ๊น ๋ถ๊ธฐ ์ค๋ฅ
๋ค์ ๋ถ๋ถ์ ํ์ธํด์ฃผ์ธ์:
- src/api/users/getFollowerList.ts, getFollowingList.ts: ์๋ฒ๊ฐ ๊ฐ
FollowDataํญ๋ชฉ์isMyselfํ๋๋ฅผ ๋ด๋ ค์ฃผ๋์ง- src/pages/feed/FollowerListPage.tsx: ์๋ฒ ์๋ต์ ๊ทธ๋๋ก ์ฌ์ฉ ์ค์ด๋ฏ๋ก, ๋๋ฝ ์
userId === currentUser.id๊ธฐ๋ฐ์ผ๋กisMyself๋ฅผ ํ ๋นํ๋ ๋ก์ง ์ถ๊ฐ ๊ฒํsrc/components/feed/UserProfileItem.tsx (1)
27-31: ๋ผ์ฐํฐ ์ ์ ๊ฒ์ฆ ์๋ฃ:/myfeed/:userId๋ฐ/otherfeed/:userId์ง์๋จ
์๋ ๊ฒฝ๋ก๊ฐsrc/pages/index.tsx์ ์ ์๋์ด ์์ด,navigate(/myfeed/${userId})ํธ์ถ์ ์ ํจํฉ๋๋ค. ๋ถ๊ธฐ ๋ก์ง์ ๊ทธ๋๋ก ์ ์งํด ์ฃผ์ธ์.
- src/pages/index.tsx:73 โ
<Route path="otherfeed/:userId" element={<OtherFeedPage />} />- src/pages/index.tsx:74 โ
<Route path="myfeed/:userId" element={<MyFeedPage />} />
| align-items: center; | ||
| position: fixed; | ||
| top: 0; | ||
| left: 0; | ||
| width: 100vw; | ||
| left: 50%; | ||
| transform: translateX(-50%); | ||
| width: 100%; | ||
| max-width: 767px; | ||
| min-width: 320px; | ||
| height: 100vh; |
There was a problem hiding this comment.
Overlay๊ฐ ์ ์ฒด ๊ฐ๋กํญ์ ๋ฎ์ง ์์ ๋ฐฐ๊ฒฝ ํด๋ฆญ/์คํฌ๋กค์ด โ์์ผ๋กโ ์๋ ๋ฌธ์ ๊ฐ ๋ฐ์ํ ์ ์์ต๋๋ค.
ํ์ฌ Overlay์ max/min-width์ ๊ฐ์ด๋ฐ ์ ๋ ฌ์ด ์ ์ฉ๋์ด, ํฐ ํ๋ฉด์์ Overlay๊ฐ ๋ทฐํฌํธ ์ ์ฒด๋ฅผ ๋ฎ์ง ์์ต๋๋ค. ์ด ๊ฒฝ์ฐ:
- ์ข์ฐ ์ฌ๋ฐฑ ์์ญ์ด Overlay ๋ฐ์ผ๋ก ๋จ์, ๋ฐฐ๊ฒฝ ํด๋ฆญ์ด ํต๊ณผ๋๊ฑฐ๋ ์คํฌ๋กค ๋ฝ์ด ์์ ํ์ง ์์ ์ ์์ต๋๋ค.
- ์ผ๋ฐ์ ์ผ๋ก๋ Overlay๊ฐ ๋ทฐํฌํธ ์ ์ฒด๋ฅผ ๋ฎ๊ณ , ์์ชฝ Modal๋ง max-width๋ก ์ผํฐ๋งํ๋ ํจํด์ด ์์ ํฉ๋๋ค.
Overlay๋ 100vw/100vh๋ก ์ ์ฒด๋ฅผ ๋ฎ๊ณ , Modal์๋ง max-width๋ฅผ ๋๋ ํํ๋ก ๋๋๋ฆฌ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.
๋ค์ ๋ณ๊ฒฝ์ผ๋ก ๋ฌธ์ ๋ฅผ ํด์ํ ์ ์์ต๋๋ค.
align-items: center;
position: fixed;
top: 0;
- left: 50%;
- transform: translateX(-50%);
- width: 100%;
- max-width: 767px;
- min-width: 320px;
+ left: 0;
+ width: 100vw;
height: 100vh;์ฐธ๊ณ :
- ์ด๋ฏธ Modal ์์ฒด์
width: 100%; max-width: 767px;๊ฐ ์์ด, Overlay๋ฅผ ์ ์ฒดํ๋ฉด์ผ๋ก ์ ์งํด๋ ์ฝํ ์ธ ๋ ๋์ผํ๊ฒ ๊ฐ์ด๋ฐ ์ ๋ ฌ๋ฉ๋๋ค(Overlay์ flex ์ ๋ ฌ์ ์ํด ์ํยท์์ง ์ผํฐ๋ง).
๐ค Prompt for AI Agents
In src/components/group/Modal.styles.ts around lines 7 to 15, the Overlay
currently uses fixed positioning with left: 50%, translateX(-50%) and
width/max-width/min-width which prevents it from covering the full viewport;
change the Overlay to span the full viewport (e.g., width: 100vw; height: 100vh;
left: 0; top: 0) and remove the centering width constraints from the Overlay,
keeping max-width/width only on the inner Modal so the Overlay covers the entire
screen while the Modal remains centered and constrained.
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and canโt be posted inline due to platform limitations.
โ ๏ธ Outside diff range comments (1)
src/components/common/Post/PostFooter.tsx (1)
112-115: ๋ณด์: window.open ์ฌ์ฉ ์ reverse tabnabbing ์ทจ์ฝ์ ์ ํญ์ ์ด ๋ opener ์ฐ๊ฒฐ์ด ์ ์ง๋์ด ๋ณด์ ์ด์๊ฐ ์๊ธธ ์ ์์ต๋๋ค. noopener/noreferrer๋ฅผ ์ง์ ํ๊ณ opener๋ฅผ ๋ช ์์ ์ผ๋ก ๋์ด์ฃผ์ธ์.
const handleComment = () => { if (isDetail) return; - window.open(`/feed/${feedId}`, '_blank'); + const newWindow = window.open(`/feed/${feedId}`, '_blank', 'noopener,noreferrer'); + if (newWindow) newWindow.opener = null; };
๐งน Nitpick comments (7)
src/components/common/Post/PostFooter.tsx (3)
73-88: ์ข์์ ๋ค์ค ํด๋ฆญ ๋ ์ด์ค์ปจ๋์ ๋ฐฉ์ง ๊ฐ๋ ์ถ๊ฐ ๊ถ์ฅ์ฐ์ ํด๋ฆญ ์ ๋์ผํ ์ด์ ์ํ(saved/liked)๋ฅผ ๊ธฐ์ค์ผ๋ก ์ฌ๋ฌ ์์ฒญ์ด ๋๊ฐ ๊ฒฐ๊ณผ๊ฐ ๋ค์ํฌ ์ ์์ต๋๋ค. in-flight ๊ฐ๋๋ก ์ค๋ณต ์์ฒญ์ ๋ง์์ฃผ์ธ์.
์๋์ ๊ฐ์ด ๊ฐ๋๋ฅผ ์ถ๊ฐํ๋ ๊ฒ์ ์ ์ํฉ๋๋ค.
const handleLike = async () => { + if (liking) return; + setLiking(true); try { const response = await postFeedLike(feedId, !liked); if (response.isSuccess) { // ์ฑ๊ณต ์ ์ํ ์ ๋ฐ์ดํธ setLiked(response.data.isLiked); setLikeCount(prev => (response.data.isLiked ? prev + 1 : prev - 1)); console.log('์ข์์ ์ํ ๋ณ๊ฒฝ ์ฑ๊ณต:', response.data.isLiked); } else { console.error('์ข์์ ์ํ ๋ณ๊ฒฝ ์คํจ:', response.message); } } catch (error) { console.error('์ข์์ API ํธ์ถ ์คํจ:', error); + } finally { + setLiking(false); } };๊ทธ๋ฆฌ๊ณ ์ํ ์ ์ธ์ ์ถ๊ฐํด์ฃผ์ธ์(์ปดํฌ๋ํธ ์๋จ state ์ ์ธ๋ถ ์ธ์ ์์น).
const [liking, setLiking] = useState(false);
90-110: ์ ์ฅ ํ ๊ธ ์ค๋ณต ํด๋ฆญ/๋ ์ด์ค ์ปจ๋์ ๋ฐฉ์ง์ ์ฅ ์์ด์ฝ๋ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ ์ ์์ต๋๋ค. ์ ์ฅ ์ค์๋ ์ถ๊ฐ ํด๋ฆญ์ ๋ฌด์ํ๋๋ก in-flight ๊ฐ๋๋ฅผ ์ถ๊ฐํ์ธ์.
const handleSave = async () => { + if (saving) return; + setSaving(true); try { const response = await postSaveFeed(feedId, !saved); if (response.isSuccess) { const newSaveState = response.data?.isSaved ?? !saved; // ์ฑ๊ณต ์ ์ํ ์ ๋ฐ์ดํธ setSaved(newSaveState); console.log('์ ์ฅ ์ํ ๋ณ๊ฒฝ ์ฑ๊ณต:', newSaveState); // ๋ถ๋ชจ ์ปดํฌ๋ํธ์ ์๋ฆผ if (onSaveToggle) { onSaveToggle(feedId, newSaveState); } } else { console.error('์ ์ฅ ์ํ ๋ณ๊ฒฝ ์คํจ:', response.message); } } catch (error) { console.error('์ ์ฅ API ํธ์ถ ์คํจ:', error); + } finally { + setSaving(false); } };์ํ ์ ์ธ์ ์ถ๊ฐํด์ฃผ์ธ์(์ปดํฌ๋ํธ ์๋จ state ์ ์ธ๋ถ ์ธ์ ์์น).
const [saving, setSaving] = useState(false);
121-127: ์ ๊ทผ์ฑ: ์์ด์ฝ์ ์ ์ ํ ๋์ฒด ํ ์คํธ ์ถ๊ฐ ๊ถ์ฅlike/comment ์์ด์ฝ์ alt๋ฅผ ์ถ๊ฐํ๋ฉด ์คํฌ๋ฆฐ ๋ฆฌ๋ ํธํ์ฑ์ด ์ข์์ง๋๋ค.
-<img src={liked ? activeLike : like} onClick={handleLike} /> +<img + src={liked ? activeLike : like} + onClick={handleLike} + alt={liked ? '์ข์์ ์ทจ์' : '์ข์์'} +/> -<img src={comment} onClick={handleComment} /> +<img src={comment} onClick={handleComment} alt="๋๊ธ" />src/pages/mypage/SavePage.tsx (4)
75-103: ์ด๊ธฐ ๋ฐ์ดํฐ ๋ณ๋ ฌ ๋ก๋ OK โ ๊ณตํต ๋ก๋ ์ฌ์ฌ์ฉ์ผ๋ก ์ค๋ณต ์ ๊ฑฐ ๊ฐ๋ฅ์ง๊ธ๋ ๋์์ ๋ฌธ์ ์์ง๋ง, ์ด๋ฏธ ์ ์ํ ๋ก๋(loadSavedFeeds, loadSavedBooks)๋ฅผ ์ฌ์ฌ์ฉํ๋ฉด ์ฝ๋๊ฐ ๋ ๊ฐ๊ฒฐํด์ง๋๋ค. ์ด๊ธฐ ๋ก๋ฉ ์คํผ๋๋ initialLoading์ผ๋ก ์ปค๋ฒ๋๋ฏ๋ก feedLoading์ ๊ตณ์ด ๊ฑด๋๋ฆฌ์ง ์์๋ ๋ฉ๋๋ค.
์์:
useEffect(() => { const loadAllData = async () => { try { setInitialLoading(true); - // ๋ API๋ฅผ ๋ณ๋ ฌ๋ก ํธ์ถ - const [feedsResponse, booksResponse] = await Promise.all([ - getSavedFeedsInMy(null), - getSavedBooksInMy(), - ]); - - // ํผ๋ ๋ฐ์ดํฐ ์ค์ - setSavedFeeds(feedsResponse.data.feedList); - setFeedNextCursor(feedsResponse.data.nextCursor); - setFeedIsLast(feedsResponse.data.isLast); - - // ์ฑ ๋ฐ์ดํฐ ์ค์ - setSavedBooks(booksResponse.data.bookList); + await Promise.all([loadSavedFeeds(null), loadSavedBooks()]); } catch (error) { console.error('์ด๊ธฐ ๋ฐ์ดํฐ ๋ก๋ ์คํจ:', error); } finally { setInitialLoading(false); } }; loadAllData(); }, []);
128-150: ํจ์๋ช ๋ช ํํ ์ ์: handleSaveToggle โ handleBookSaveToggle๋์ผ ํ์ผ์ ํผ๋์ฉ handleFeedSaveToggle์ด ์์ด ํผ๋ ์ฌ์ง๊ฐ ์์ต๋๋ค. ์ฑ /ํผ๋ ๊ตฌ๋ถ์ด ๋๋ฌ๋๋๋ก ์ด๋ฆ์ ๋ฐ๊พธ๋ฉด ๊ฐ๋ ์ฑ์ด ์ข์์ง๋๋ค.
-const handleSaveToggle = async (isbn: string) => { +const handleBookSaveToggle = async (isbn: string) => { try { const currentBook = savedBooks.find(book => book.isbn === isbn); if (!currentBook) return; const newSaveState = !currentBook.isSaved; await postSaveBook(isbn, newSaveState); // ์ ์ฅ ์ทจ์์ธ ๊ฒฝ์ฐ ์ ์ฅ๋ ์ฑ ๋ชฉ๋ก์ ๋ค์ ๋ถ๋ฌ์ด if (!newSaveState) { await loadSavedBooks(); } else { // ์ ์ฅ์ธ ๊ฒฝ์ฐ ๋ก์ปฌ ์ํ๋ง ์ ๋ฐ์ดํธ setSavedBooks(prev => prev.map(book => (book.isbn === isbn ? { ...book, isSaved: newSaveState } : book)), ); } console.log('์ ์ฅ ํ ๊ธ:', isbn, newSaveState); } catch (error) { console.error('์ ์ฅ ํ ๊ธ ์คํจ:', error); } };์๋ ํธ์ถ๋ถ๋ ํจ๊ป ๋ณ๊ฒฝํด์ฃผ์ธ์(์ฐธ๊ณ ์ฝ๋):
<SaveIcon onClick={() => handleBookSaveToggle(book.isbn)}>
152-164: ๋ถํ์ํ async/try-catch ์ ๊ฑฐ + useCallback์ผ๋ก ๋ฉ๋ชจ์ด์ฆ๋น๋๊ธฐ ๋ก์ง์ด ์์ผ๋ฏ๋ก async/try-catch๋ ๋ถํ์ํฉ๋๋ค. useCallback์ผ๋ก ๋ํํ๋ฉด ์์(FeedPost)๋ก ๋ด๋ ค๊ฐ ๋ ํจ์ ์์ด๋ดํฐํฐ๊ฐ ์์ ๋ผ ์๋ฏธ ์๋ ๋ฆฌ๋ ๋๊ฐ ์ค์ด๋ญ๋๋ค.
-const handleFeedSaveToggle = async (feedId: number, newSaveState: boolean) => { - try { - if (!newSaveState) { - // ์ ์ฅ ์ทจ์์ธ ๊ฒฝ์ฐ ๋ฆฌ์คํธ์์ ์ ๊ฑฐ - setSavedFeeds(prev => prev.filter(feed => feed.feedId !== feedId)); - console.log('ํผ๋ ์ ์ฅ ์ทจ์ ์๋ฃ:', feedId); - } - } catch (error) { - console.error('ํผ๋ ์ ์ฅ ์ํ ๋ณ๊ฒฝ ์คํจ:', error); - } -}; +const handleFeedSaveToggle = useCallback((feedId: number, newSaveState: boolean) => { + if (!newSaveState) { + // ์ ์ฅ ์ทจ์์ธ ๊ฒฝ์ฐ ๋ฆฌ์คํธ์์ ์ ๊ฑฐ + setSavedFeeds(prev => prev.filter(feed => feed.feedId !== feedId)); + console.log('ํผ๋ ์ ์ฅ ์ทจ์ ์๋ฃ:', feedId); + } +}, []);
291-297: ์ค๋ณต ์คํ์ผ ์ ๊ฑฐ: width: 100%๊ฐ ๋ ๋ฒ ์ ์ธ๋จBookList์์ width: 100%๊ฐ ์ค๋ณต์ ๋๋ค. ํ๋๋ฅผ ์ ๊ฑฐํด ์ฃผ์ธ์.
const BookList = styled.div` display: flex; flex-direction: column; width: 100%; min-width: 320px; max-width: 767px; padding-top: 32px; margin: 0 auto; - width: 100%; `;
๐ Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
๐ก Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
๐ Files selected for processing (4)
src/components/common/Post/PostFooter.tsx(3 hunks)src/components/feed/FeedPost.tsx(1 hunks)src/pages/mypage/SavePage.tsx(7 hunks)src/types/post.ts(1 hunks)
๐งฐ Additional context used
๐งฌ Code Graph Analysis (2)
src/components/feed/FeedPost.tsx (1)
src/types/post.ts (1)
FeedPostProps(29-35)
src/pages/mypage/SavePage.tsx (1)
src/api/books/getSavedBooksInMy.ts (1)
getSavedBooksInMy(28-36)
๐ Additional comments (5)
src/types/post.ts (1)
34-34: onSaveToggle ์ฝ๋ฐฑ ์ถ๊ฐ ์ ์ FeedPost์์ ์ ์ฅ ์ํ ๋ณํ ์ด๋ฒคํธ๋ฅผ ์์๋ก ํต์งํ ์ ์๊ฒ ๋์ด ์ํ ๋๊ธฐํ๊ฐ ๊น๋ํด์ก์ต๋๋ค. PostFooter ์ชฝ ์๊ทธ๋์ฒ์๋ ์ผ์นํฉ๋๋ค.
src/components/common/Post/PostFooter.tsx (1)
55-56: PostFooter์ onSaveToggle ์ถ๊ฐ ๋ฐ ์ ๋ฌ OK์ต์ ๋ ์ฝ๋ฐฑ์ผ๋ก ์์ ํ๊ฒ ์ฒ๋ฆฌํ๊ณ , ๋ถ๋ชจ ํต์ง ๊ฒฝ๋ก๊ฐ ๋ช ํํฉ๋๋ค.
Also applies to: 67-68
src/components/feed/FeedPost.tsx (1)
29-36: onSaveToggle ์ ๋ฌ ๊ฒฝ๋ก ์ ์Props ๋ถํด/์ ๋ฌ ์์๊ฐ ์ ์ ํ๊ณ , spread๋ก ๋ฎ์ด์ฐ์ง ์๋๋ก ์ฃผ์ํ ์ ๋ ์ข์ต๋๋ค. PostFooter์ ํ์ ๋ ์ผ์นํฉ๋๋ค.
src/pages/mypage/SavePage.tsx (2)
42-51: ์ ์ฅ๋ ์ฑ ๋ชฉ๋ก ๋ก๋ ๋ถ๋ฆฌ ์ข์ต๋๋คAPI ์ค๋ฅ ๋ก๊น ๊ณผ ์ํ ๋ฐ์์ด ๋ช ํํฉ๋๋ค. ์ดํ ๋ค๋ฅธ ๊ณณ์์๋ ์ฌ์ฌ์ฉ ๊ฐ๋ฅํด ์ ์ง๋ณด์์ฑ์ ์ด์ ์ด ์์ต๋๋ค.
185-186: FeedPost์ onSaveToggle ์ฐ๋ OK์ธ์ธ์ด๋ธ ์ ๋ฆฌ์คํธ์์ ์ ๊ฑฐ๋๋ UX๊ฐ ์์ฐ์ค๋ฝ์ต๋๋ค. ์ฝ๋ฐฑ ์๊ทธ๋์ฒ๋ ์ผ์นํฉ๋๋ค.
There was a problem hiding this comment.
Actionable comments posted: 0
๐งน Nitpick comments (2)
src/components/common/Post/PostBody.tsx (2)
12-12: ์นด๋ ์ ์ฒด์ pointer ์ ์ฉ์ ์ข์ต๋๋ค. ๋ค๋ง BookInfo ์์ญ์๋ ํฌ์ธํฐ ํด์ ๋ฅผ ๊ถ์ฅํฉ๋๋ค.์ปจํ ์ด๋์
cursor: pointer์ถ๊ฐ๋ก ํด๋ฆญ ๊ฐ๋ฅ์ฑ์ด ์ ๋๋ฌ๋ฉ๋๋ค. ๋ฐ๋ฉด,BookInfoCard์์ญ์ ํด๋ฆญ ์ ํ๋ฅผ ๋ง์ ์์ธ ์ด๋์ด ์ ๋๋ฏ๋ก, ํฌ์ธํฐ ์ปค์๊ฐ ์ ์ง๋๋ฉด ์ฌ์ฉ์์๊ฒ ํผ์ ์ ์ค ์ ์์ต๋๋ค. ํด๋น ๋ํผ์cursor: default๋ง ์ง์ ํด์ฃผ๋ฉด ์๊ฐ์ ํผ๋๋ฐฑ์ด ์ผ๊ด๋ฉ๋๋ค. ๋ํ.content์๋ ๋ณ๋cursor: pointer๊ฐ ์์ด ์ค๋ณต์ ๋๋ค. ์ปจํ ์ด๋์์ ์ด๋ฏธ ํฌ์ธํฐ๋ฅผ ์ฃผ๊ณ ์์ผ๋ฏ๋ก.content์ ํฌ์ธํฐ๋ ์ ๊ฑฐํด๋ ๋ฉ๋๋ค.์๋์ฒ๋ผ BookInfoCard ๋ํผ์ ์ปค์๋ง ๋ฎ์ด์์ฐ๋ฉด ์ถฉ๋ถํฉ๋๋ค:
- <div onClick={(e) => e.stopPropagation()}> + <div onClick={(e) => e.stopPropagation()} style={{ cursor: 'default' }}> <BookInfoCard bookTitle={bookTitle} bookAuthor={bookAuthor} isbn={isbn} /> </div>Also applies to: 87-87
71-74: ์ ํญ ์ด๊ธฐ ๋ณด์ยท์ ๊ทผ์ฑ ๋ณด์: noopener/noreferrer, ํค๋ณด๋ ์ ๊ทผ์ฑ, ํ ์คํธ ๋๋๊ทธ ๊ฐ๋ ์ถ๊ฐ ์ ์
- ๋ณด์:
window.open์noopener,noreferrer๋ฅผ ์ง์ ํ๊ณopener๋ฅผ ๋ช ์์ ์ผ๋ก ๋์ด reverse tabnabbing์ ์๋ฐฉํ์ธ์.- ์ ๊ทผ์ฑ: div ํด๋ฆญ ๋ด๋น๊ฒ์ด์ ์๋
role="link"์tabIndex=0, Enter/Space ํค ์ฒ๋ฆฌ๋ก ํค๋ณด๋ ์ ๊ทผ์ฑ์ ์ ๊ณตํ๋ ๊ฒ์ด ์ข์ต๋๋ค.- UX: ํ ์คํธ ๋๋๊ทธ ํ ํด๋ฆญ์ผ๋ก ์๋์น ์๊ฒ ์ ํญ์ด ์ด๋ฆฌ๋ ๊ฒ์ ๋ฐฉ์งํ๊ธฐ ์ํด ์ ํ ํ ์คํธ ์กด์ฌ ์ ๋ค๋น๊ฒ์ด์ ์ ๊ฑด๋๋ฐ๋ ๊ฐ๋๋ฅผ ๋๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.
์๋์ฒ๋ผ ์ต์ ์์ ์ผ๋ก ๋ฐ์ํ ์ ์์ต๋๋ค:
@@ - const handlePostClick = (feedId: number) => { - // ์ ํญ์์ ํผ๋ ์์ธ ํ์ด์ง ์ด๊ธฐ - window.open(`/feed/${feedId}`, '_blank'); - }; + const handlePostClick = (feedId: number) => { + // ์ ํญ์์ ํผ๋ ์์ธ ํ์ด์ง ์ด๊ธฐ (๋ณด์: noopener/noreferrer) + const win = window.open(`/feed/${feedId}`, '_blank', 'noopener,noreferrer'); + if (win) win.opener = null; + }; @@ - <Container onClick={() => handlePostClick(feedId)}> + <Container + role="link" + tabIndex={0} + onKeyDown={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + handlePostClick(feedId); + } + }} + onClick={(e) => { + const selection = window.getSelection?.(); + if (selection && selection.toString()) return; + handlePostClick(feedId); + }} + >์ฐธ๊ณ : ๊ฐ๋ฅํ๋ฉด ์๋งจํฑํ๊ฒ
<a>์ฌ์ฉ๋ ๊ณ ๋ คํด๋ณผ ์ ์์ต๋๋ค(์:<Container as="a" href=... target="_blank" rel="noopener noreferrer">). ๋ค๋ง ๋ด๋ถ์ ๋ ๋ค๋ฅธ ์ต์ปค๊ฐ ์ค์ฒฉ๋ ์ ์์ผ๋ฉด ํ์ฌ div + ํธ๋ค๋ฌ ์ ๊ทผ์ด ๋ ์์ ํฉ๋๋ค.Also applies to: 86-90
๐ Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
๐ก Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
๐ Files selected for processing (1)
src/components/common/Post/PostBody.tsx(2 hunks)
#๏ธโฃ์ฐ๊ด๋ ์ด์
์์
๐์์ ๋ด์ฉ
๐ฌ๋ฆฌ๋ทฐ ์๊ตฌ์ฌํญ
์์
Summary by CodeRabbit
New Features
Style
UX