Conversation
WalkthroughPostBodyμ μ΄λ―Έμ§ μ€νμΌμ Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant UI as SavePage UI
participant Obs as IntersectionObserver
participant API as getSavedBooksInMy(cursor)
participant State as Local State
Note over UI,Obs: μ΄κΈ° λ‘λ
UI->>API: getSavedBooksInMy(null)
API-->>UI: { bookList, nextCursor, isLast }
UI->>State: set savedBooks, bookNextCursor, bookIsLast
Note over UI,Obs: μ€ν¬λ‘€λ‘ λ§μ§λ§ νλͺ© κ΄μ°° μ
Obs->>UI: lastItem intersecting
alt λ λΆλ¬μ¬ μ μμ (nextCursor && !isLast && !bookLoading)
UI->>State: set bookLoading=true
UI->>API: getSavedBooksInMy(bookNextCursor)
API-->>UI: { bookList, nextCursor, isLast }
UI->>State: append savedBooks, update bookNextCursor, bookIsLast, set bookLoading=false
else λ‘λ λΆνμ
Obs-->>UI: no-op
end
Estimated code review effortπ― 4 (Complex) | β±οΈ ~45 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. β¨ 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 (
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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 (5)
src/components/common/Post/PostBody.tsx (2)
74-77: 보μ: reverse tabnabbing λ°©μ§μ© noopener/noreferrer μΆκ° νμ
window.open(..., '_blank')λ μ νμμ λΆλͺ¨ μ°½ μ μ΄κ° κ°λ₯ν΄μ§λλ€. μΈ λ²μ§Έ μΈμμnoopener,noreferrerλ₯Ό μ μ©ν΄ μ£ΌμΈμ.μλμ²λΌ μμ κΆμ₯:
- window.open(`/feed/${feedId}`, '_blank'); + window.open(`/feed/${feedId}`, '_blank', 'noopener,noreferrer');
103-105: μ΄λ―Έμ§ μ κ·Όμ±/μ±λ₯: alt, lazy λ‘λ©, μμ ν€ μ μ©
- alt λΆμ¬: μ½ν μΈ μ΄λ―Έμ§λ‘ 보μ΄λ―λ‘ λ체 ν μ€νΈ νμ
- νΌν¬λ¨Όμ€: μΈλ€μΌμ
loading="lazy",decoding="async"κΆμ₯- key: index λμ μμ ν€ μ¬μ© κΆμ₯
- {contentUrls.map((src: string, i: number) => ( - <img key={i} src={src} /> - ))} + {contentUrls.map((src: string, i: number) => ( + <img + key={`${i}-${src}`} + src={src} + alt={`νΌλ μ΄λ―Έμ§ ${i + 1}`} + loading="lazy" + decoding="async" + /> + ))}src/pages/mypage/Mypage.tsx (3)
78-79: 보μ: μΈλΆ λ§ν¬window.openλͺ¨λμ noopener/noreferrer μ μ©μ¬λ¬ κ³³μμ
_blankλ₯Ό μ¬μ©νκ³ μμ΄ reverse tabnabbing μνμ΄ μμ΅λλ€. μΈ κ΅°λ° λͺ¨λ λμΌνκ² λ³΄νΈ νλκ·Έλ₯Ό μΆκ°ν΄ μ£ΌμΈμ.- window.open('https://slashpage.com/thip/7vgjr4m1nynpy2dwpy86', '_blank'); + window.open('https://slashpage.com/thip/7vgjr4m1nynpy2dwpy86', '_blank', 'noopener,noreferrer'); - window.open('https://slashpage.com/thip/ywk9j72989p6rmgpqvnd', '_blank'); + window.open('https://slashpage.com/thip/ywk9j72989p6rmgpqvnd', '_blank', 'noopener,noreferrer'); - window.open('https://slashpage.com/thip/dk58wg2e6yy3zmnqevxz', '_blank'); + window.open('https://slashpage.com/thip/dk58wg2e6yy3zmnqevxz', '_blank', 'noopener,noreferrer'); - window.open('https://slashpage.com/thip/7916x82r8y74n24kpyg3', '_blank'); + window.open('https://slashpage.com/thip/7916x82r8y74n24kpyg3', '_blank', 'noopener,noreferrer'); - window.open('https://slashpage.com/thip/1q3vdn2p9w93pmxy49pr', '_blank'); + window.open('https://slashpage.com/thip/1q3vdn2p9w93pmxy49pr', '_blank', 'noopener,noreferrer');Also applies to: 94-95, 98-99, 102-103, 106-107
115-116: νλ‘ν μ΄λ―Έμ§μ λ체 ν μ€νΈ μΆκ°μκ°μ μ 보 μ λ¬ μμμ΄λ―λ‘ alt ν μ€νΈλ₯Ό μ 곡νμΈμ. μ κ·Όμ± κΈ°λ³Έ μ건μ λλ€.
- <img src={profile.profileImageUrl} /> + <img src={profile.profileImageUrl} alt="νλ‘ν μ΄λ―Έμ§" />
146-146: μ¬μ©μ λ ΈμΆ ν μ€νΈ μ€νμ μμ : βλ²μ Όβ β βλ²μ βνκ΅μ΄ νμ€ νκΈ°μ λλ€. μ¬μ©μ μ λ’°λ κ΄μ μμ μ¦μ μμ κΆμ₯.
- <MenuButton src={ver} name="λ²μ Ό 1.0.0" isButton onClick={handleVersion} /> + <MenuButton src={ver} name="λ²μ 1.0.0" isButton onClick={handleVersion} />
π§Ή Nitpick comments (4)
src/components/common/Post/PostBody.tsx (2)
79-86: λ§μ€μ κ°μ§ μμ‘΄μ± λ³΄μ
-webkit-line-clampκ°μ΄hasImageμ λ°λΌ λ¬λΌμ§λ―λ‘, μ΄λ―Έμ§ μ λ¬΄κ° λ°λ λλ λ§μ€μ μ¬νκ°κ° νμν©λλ€.μλμ²λΌ μμ‘΄μ±μ
hasImageλ₯Ό μΆκ°ν΄ μ£ΌμΈμ.- }, [contentBody]); + }, [contentBody, hasImage]);
97-99: μ₯μ μμ΄μ½ μ κ·Όμ±: μ€ν¬λ¦°λ¦¬λ λ ΈμΆ μ κ±°'λ보기' μμ΄μ½μ λΉμνΈμμ© μ₯μ μμμ λλ€. μ€ν¬λ¦°λ¦¬λ λ ΈμΆμ λ§μ νΌλμ μ€μ¬μ£ΌμΈμ.
- {isTruncated && <img src={lookmore} alt="λ보기" className="lookmore-icon" />} + {isTruncated && <img src={lookmore} alt="" aria-hidden="true" className="lookmore-icon" />}src/pages/mypage/Mypage.tsx (2)
222-227: νμ΄ν¬κ·ΈλνΌ ν ν° κ΅μ²΄ LGTM + μκ° κ° κ²ν μ μν ν° μΉν μΌκ΄μ± μ’μ΅λλ€. λ€λ§
letter-spacing: 0.018px;μ μ€μ°¨ μμ€μ λ―Έμ κ°μ λλ€. λμμΈ μλλ©΄ ν ν°ννκ±°λ(μ:var(--letter-spacing-md)) μμ μ리 μ κ·ν κ²ν λ°λλλ€.
230-233: .usertitle μμ μ κ±°μ λ°λ₯Έ ν΄λ°± νμΈ νμμ€νμΌμμ μμμ μ κ±°νκ³ , μ€μ μμμ JSX μΈλΌμΈ μ€νμΌ(λΌμΈ 118)
profile.aliasColorλ‘ μ μ©λ©λλ€. aliasColorκ° μμ λμ ν΄λ°± μμμ΄ μ¬λΌμ‘μ μ μμΌλ νμΈ λ°λλλ€.μΈλΌμΈ μ€νμΌμ μμ ν ν΄λ°± μΆκ° μ μ(λΌμΈ 117-120 μ°Έκ³ ):
- <div className="usertitle" style={{ color: profile.aliasColor }}> + <div + className="usertitle" + style={{ color: profile.aliasColor ?? 'var(--color-text-secondary_grey00, #dadada)' }} + >
π 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 (2)
src/components/common/Post/PostBody.tsx(1 hunks)src/pages/mypage/Mypage.tsx(1 hunks)
π Additional comments (1)
src/components/common/Post/PostBody.tsx (1)
55-59: μΈλ€μΌ ν¬λ‘ νμ§ κ°μ LGTM100x100 κ³ μ μμμμ λΉμ¨ μ μ§ ν¬λ‘μ μν
object-fit: cover;μΆκ° μ μ ν©λλ€. κΈ°λν βμ΄λ―Έμ§ κΉ¨μ§β μ΄μμ λ°λ‘ ν¨λ ₯μ΄ μμ΅λλ€.
There was a problem hiding this comment.
Actionable comments posted: 0
π§Ή Nitpick comments (6)
src/api/books/getSavedBooksInMy.ts (2)
15-19: nextCursor null κ°λ₯μ± λλΉ: νμ μ string | nullλ‘ λ³κ²½ κΆμ₯μλ²κ° λ§μ§λ§ νμ΄μ§μμ nextCursorλ₯Ό nullλ‘ μ€ μ μμ΅λλ€. μμ νκ²
string | nullλ‘ μ μΈν΄ μ£ΌμΈμ. νμ μ μλ² μ€ν νμΈ λ°λλλ€.export interface SavedBooksInMyData { bookList: SavedBookInMy[]; - nextCursor: string; + nextCursor: string | null; isLast: boolean; }
30-39: params λΉλ κ°μν λ° λΉ params μ μ‘ λ°©μ§ + λ°ν νμ λͺ μλΉ κ°μ²΄λ₯Ό paramsλ‘ λ³΄λ΄μ§ μλλ‘ νκ³ , ν¨μ λ°ν νμ μ λͺ μν΄ νμ μμ μ±μ λμ΄λ νΈμ΄ μ’μ΅λλ€. λΉ λ¬Έμμ΄ cursorκ° λ€μ΄κ°λ κ²λ λ°©μ§ν©λλ€.
-export const getSavedBooksInMy = async (cursor: string | null = null) => { +export const getSavedBooksInMy = async ( + cursor: string | null = null, +): Promise<SavedBooksInMyResponse> => { try { - const params: { cursor?: string | null } = {}; - if (cursor !== null) { - params.cursor = cursor; - } + const params = cursor ? { cursor } : undefined; - const response = await apiClient.get<SavedBooksInMyResponse>('/books/saved', { - params, - }); + const response = await apiClient.get<SavedBooksInMyResponse>('/books/saved', { params }); return response.data;src/pages/mypage/SavePage.tsx (4)
40-40: IntersectionObserver λμ/μ€λ³΅ κ΄μ°° κ°λ₯μ± λ° λ―Έμ¬μ© ref μ 리
lastBookElementCallbackλ΄μμ λ§€λ² μ Observerλ₯Ό λ§λ€κ³ ν΄μ νμ§ μμ λμ/μ€λ³΅ νΈλ¦¬κ±° κ°λ₯μ±μ΄ μμ΅λλ€.bookObserverRefλ μμ±λ§ λκ³ κ΄μ°°μ μ¬μ©λμ§ μμ΅λλ€.λ¨μΌ Observer μΈμ€ν΄μ€λ‘ κ΄λ¦¬νκ³ , μ΄μ κ΄μ°°μ
disconnect()λ‘ μ λ¦¬ν΄ μ£ΌμΈμ. λν μ¬μ©νμ§ μλbookObserverRefμ JSXμ ν΄λΉ refλ₯Ό μ κ±°νλ νΈμ΄ λͺ νν©λλ€.- const bookObserverRef = useRef<HTMLDivElement>(null); + const bookLastObserverRef = useRef<IntersectionObserver | null>(null);- const lastBookElementCallback = useCallback( - (node: HTMLDivElement | null) => { - if (bookLoading || bookIsLast) return; - - if (node) { - const observer = new IntersectionObserver(entries => { - if (entries[0].isIntersecting && !bookLoading && !bookIsLast) { - loadMoreBooks(); - } - }); - - observer.observe(node); - } - }, - [bookLoading, bookIsLast, loadMoreBooks], - ); + const lastBookElementCallback = useCallback( + (node: HTMLDivElement | null) => { + if (bookLastObserverRef.current) { + bookLastObserverRef.current.disconnect(); + bookLastObserverRef.current = null; + } + if (!node || bookLoading || bookIsLast) return; + bookLastObserverRef.current = new IntersectionObserver( + entries => { + if (entries[0].isIntersecting && !bookLoading && !bookIsLast && bookNextCursor) { + loadSavedBooks(bookNextCursor); + } + }, + { threshold: 0.1 }, + ); + bookLastObserverRef.current.observe(node); + }, + [bookLoading, bookIsLast, bookNextCursor, loadSavedBooks], + ); + + useEffect(() => { + return () => bookLastObserverRef.current?.disconnect(); + }, []);- {savedBooks.map((book, index) => ( - <BookItem - key={book.bookId} - ref={index === savedBooks.length - 1 ? lastBookElementCallback : null} - > + {savedBooks.map((book, index) => ( + <BookItem + key={book.bookId} + ref={index === savedBooks.length - 1 ? lastBookElementCallback : null} + >(μ JSXλ ref μ μ§, μλ sentinel refλ§ μ κ±°)
- {!bookIsLast && ( - <div ref={bookObserverRef} style={{ height: '20px' }}> + {!bookIsLast && ( + <div style={{ height: '20px' }}> {bookLoading && <LoadingSpinner fullHeight={false} size="small" />} </div> )}Also applies to: 103-119, 254-258, 277-281
92-101: loadMoreBooksλ μ½λ°± λ΄λΆλ‘ ν‘μ κ°λ₯μ κ°μ μ μ μ© μ
loadMoreBooksλ λΆνμν΄μ§λλ€. μ κ±°ν΄ μ½λ κ²½λννμΈμ.- const loadMoreBooks = useCallback(async () => { - if (!bookNextCursor || bookIsLast || bookLoading) return; - - try { - await loadSavedBooks(bookNextCursor); - } catch (error) { - console.error('μ± μΆκ° λ‘λ μ€ν¨:', error); - } - }, [bookNextCursor, bookIsLast, bookLoading, loadSavedBooks]);
176-198: μ± μ μ₯ μ·¨μ μ μ 체 μ¬μ‘°ν λμ λ‘컬 μνμμ μ κ±° κΆμ₯νΌλ μ²λ¦¬μ λμΌνκ² λ‘컬 μνλ₯Ό κ°±μ νλ©΄ UXμ νΈλν½ λͺ¨λ κ°μ λ©λλ€.
// μ μ₯ μ·¨μμΈ κ²½μ° μ μ₯λ μ± λͺ©λ‘μ λ€μ λΆλ¬μ΄ if (!newSaveState) { - await loadSavedBooks(); + setSavedBooks(prev => prev.filter(book => book.isbn !== isbn)); } else { // μ μ₯μΈ κ²½μ° λ‘컬 μνλ§ μ λ°μ΄νΈ setSavedBooks(prev => prev.map(book => (book.isbn === isbn ? { ...book, isSaved: newSaveState } : book)), ); }
345-354: μ€λ³΅λ width μ μΈ μ κ±°
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 (2)
src/api/books/getSavedBooksInMy.ts(2 hunks)src/pages/mypage/SavePage.tsx(6 hunks)
π§° Additional context used
𧬠Code graph analysis (2)
src/api/books/getSavedBooksInMy.ts (1)
src/api/index.ts (1)
apiClient(7-14)
src/pages/mypage/SavePage.tsx (2)
src/api/books/getSavedBooksInMy.ts (1)
getSavedBooksInMy(30-45)src/styles/global/global.ts (1)
colors(4-53)
π Additional comments (1)
src/pages/mypage/SavePage.tsx (1)
31-34: 무νμ€ν¬λ‘€ μν μΆκ° LGTM
bookNextCursor,bookIsLast,bookLoadingμΆκ° λ°©ν₯ μ μ ν©λλ€.
#οΈβ£μ°κ΄λ μ΄μ
μμ
πμμ λ΄μ©
π¬λ¦¬λ·° μꡬμ¬ν
μμ
Summary by CodeRabbit
μλ‘μ΄ κΈ°λ₯
μ€νμΌ
λ²κ·Έ μμ