-
Notifications
You must be signed in to change notification settings - Fork 2
[FEAT]: 홈/카테고리 상품 카드 찜하기 기능 확장 #68
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
Merged
Seoje1405
merged 6 commits into
IT-Cotato:develop
from
Seoje1405:refactor/home-wishlist
Feb 17, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ad29623
feat: 홈 추천 상품/브랜드 카드에 찜하기 로직 추가
Seoje1405 fb33734
feat: 하위 카테고리 상품 카드에 찜하기 버튼 추가
Seoje1405 2a148a6
fix: 추천 브랜드 찜 상태 동기화 및 요청 캐시 옵션 정리
Seoje1405 3ff28f8
refactor: ProductWithWishlist 타입 공통화 및 추천 브랜드 클라이언트 상태 정리
Seoje1405 c9adc0f
fix: 추천 브랜드 API 호출에 revalidate 캐시 옵션 적용
Seoje1405 462bd29
fix: 메인 하단 내비게이션 z-index 상향으로 홈 추천상품 영역 겹침 해결
Seoje1405 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 26 additions & 2 deletions
28
src/components/recommend-brand/recommended-brand-container.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,33 @@ | ||
| import { api } from '@/lib/api-client'; | ||
| import { BrandWithProducts } from '@/types/domain/brand'; | ||
| import RecommendedBrandClient from './recommended-brand-client'; | ||
| import { getMyWishlist } from '@/app/actions/wishlist'; | ||
|
|
||
| export default async function RecommendedBrandContainer() { | ||
| const brands = await api.get<BrandWithProducts[]>('/brands/recommend'); | ||
| const [brandsResult, wishlistResult] = await Promise.allSettled([ | ||
| api.get<BrandWithProducts[]>('/brands/recommend', { | ||
| cache: 'force-cache', | ||
| next: { revalidate: 60 }, | ||
| }), | ||
| getMyWishlist(), | ||
| ]); | ||
|
|
||
| return <RecommendedBrandClient brands={brands} />; | ||
| const brands = brandsResult.status === 'fulfilled' ? brandsResult.value : []; | ||
| const wishlistItems = | ||
| wishlistResult.status === 'fulfilled' ? wishlistResult.value : []; | ||
|
|
||
| const wishlistByProductId = new Map( | ||
| wishlistItems.map((item) => [item.productId, item.wishlistId]), | ||
| ); | ||
|
|
||
| const brandsWithWishlist = brands.map((brand) => ({ | ||
| ...brand, | ||
| products: brand.products.map((product) => ({ | ||
| ...product, | ||
| isLiked: wishlistByProductId.has(product.id), | ||
| wishlistId: wishlistByProductId.get(product.id), | ||
| })), | ||
| })); | ||
|
|
||
| return <RecommendedBrandClient brands={brandsWithWishlist} />; | ||
| } |
27 changes: 18 additions & 9 deletions
27
src/components/recommend-brand/recommended-brand-grid-card.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Promise.all→Promise.allSettled변경 권장 — 다른 컨테이너와 일관성 및 탄력성 확보.recommend-product-container.tsx와recommended-brand-container.tsx는Promise.allSettled를 사용하여 위시리스트 조회 실패 시에도 상품 목록을 정상 표시합니다. 이 파일만Promise.all을 사용하면, 위시리스트 API 장애(또는 비로그인 시 인증 에러)가 상품 목록 전체를 깨뜨릴 수 있습니다.getMyWishlist내부에 try/catch가 있지만,rethrowNextError가 Next.js redirect/notFound 에러를 다시 던지므로Promise.all에서 전파될 수 있습니다.🛡️ Promise.allSettled 적용
📝 Committable suggestion
🤖 Prompt for AI Agents