From 1617da223b500c86c9d25bdf6cae54b5e602e2b7 Mon Sep 17 00:00:00 2001 From: "junghoon86.park" Date: Wed, 12 Nov 2025 09:33:58 +0900 Subject: [PATCH] =?UTF-8?q?[=EB=A9=94=EC=9D=B8=20=EB=85=B8=EC=B6=9C]=20?= =?UTF-8?q?=EC=B6=94=EC=B2=9C=EC=83=81=ED=92=88=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 몇개가 들어올지 모른다하여 기존 slice로 잘라서 저장하는부분에 대하여 삭제. --- .../views/HomePanel/BestSeller/BestSeller.jsx | 36 +++++++++---------- .../HomePanel/PopularShow/PopularShow.jsx | 8 ++--- .../HomePanel/SubCategory/SubCategory.jsx | 8 ++--- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/com.twin.app.shoptime/src/views/HomePanel/BestSeller/BestSeller.jsx b/com.twin.app.shoptime/src/views/HomePanel/BestSeller/BestSeller.jsx index da67d568..ee16c131 100644 --- a/com.twin.app.shoptime/src/views/HomePanel/BestSeller/BestSeller.jsx +++ b/com.twin.app.shoptime/src/views/HomePanel/BestSeller/BestSeller.jsx @@ -85,28 +85,28 @@ const BestSeller = ({ const [bestItemNewData, setBestItemNewData] = useState([]); useEffect(()=>{ - setBestInfos( - bestSellerNewDatas?.filter( - (item) => item.recommendTpCd === "BESTSELLER" - ) || [] // 기본값으로 빈 배열 설정 - ) -},[bestSellerNewDatas]) + setBestInfos( + bestSellerNewDatas?.filter( + (item) => item.recommendTpCd === "BESTSELLER" + ) || [] // 기본값으로 빈 배열 설정 + ) + },[bestSellerNewDatas]) useEffect(() => { if (!bestInfos || bestInfos.length === 0) { - const baseData = bestSellerDatas?.map((item) => ({ - ...item, - foryou: false, - })) || []; - setBestItemNewData(baseData); - return; - } + const baseData = bestSellerDatas?.map((item) => ({ + ...item, + foryou: false, + })) || []; + setBestItemNewData(baseData); + return; + } - const recommendedData = bestInfos[0].productInfos?.slice(0, 20).map((item) => ({ - ...item, - foryou: true, - })) || []; - + const recommendedData = bestInfos[0].productInfos?.map((item) => ({ + ...item, + foryou: true, + })) || []; + const recommendedPrdtIds = new Set(recommendedData.map(item => item.prdtId)); const baseData = bestSellerDatas?.map((item) => ({ diff --git a/com.twin.app.shoptime/src/views/HomePanel/PopularShow/PopularShow.jsx b/com.twin.app.shoptime/src/views/HomePanel/PopularShow/PopularShow.jsx index 3cc95ec5..4d5711db 100644 --- a/com.twin.app.shoptime/src/views/HomePanel/PopularShow/PopularShow.jsx +++ b/com.twin.app.shoptime/src/views/HomePanel/PopularShow/PopularShow.jsx @@ -104,18 +104,16 @@ const PopularShow = ({ return; } - const recommendedData = showInfos[0].showInfos?.slice(0, 2).map((item) => ({ + const recommendedData = showInfos[0].showInfos?.map((item) => ({ ...item, foryou: true, })) || []; const recommendedPrdtIds = new Set(recommendedData?.map(item => item.showId)); - const baseData = topInfos?.filter( - (item) => !recommendedPrdtIds.has(item.showId) - ).map((item) => ({ + const baseData = topInfos?.map((item) => ({ ...item, - foryou: false, + foryou: recommendedPrdtIds.has(item.showId), })) || []; setShowNewInfos([...recommendedData, ...baseData]); diff --git a/com.twin.app.shoptime/src/views/HomePanel/SubCategory/SubCategory.jsx b/com.twin.app.shoptime/src/views/HomePanel/SubCategory/SubCategory.jsx index 3244ff02..5425bc94 100644 --- a/com.twin.app.shoptime/src/views/HomePanel/SubCategory/SubCategory.jsx +++ b/com.twin.app.shoptime/src/views/HomePanel/SubCategory/SubCategory.jsx @@ -236,18 +236,16 @@ export default memo(function SubCategory({ return; } - const recommendedData = foruItemInfos?.slice(0, 10).map((item) => ({ + const recommendedData = foruItemInfos?.map((item) => ({ ...item, foryou: true, })) || []; const recommendedPrdtIds = new Set(recommendedData.map(item => item.prdtId)); - const baseData = categoryItemInfos?.subCatItemList?.filter( - (item) => !recommendedPrdtIds.has(item.prdtId) - ).map((item) => ({ + const baseData = categoryItemInfos?.subCatItemList?.map((item) => ({ ...item, - foryou: false, + foryou: recommendedPrdtIds.has(item.prdtId), })) || []; setCategoryItemNewData([...recommendedData, ...baseData]);