From 25fee0bfb5854daf9b225df7cd4e61d508a9eb43 Mon Sep 17 00:00:00 2001 From: "junghoon86.park" Date: Tue, 11 Nov 2025 14:42:37 +0900 Subject: [PATCH] =?UTF-8?q?[popularshow]=20=EC=97=90=EB=9F=AC=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - showInfos가 undefined 일때 처리 추가. --- .../HomePanel/PopularShow/PopularShow.jsx | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) 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 a677a14e..3cc95ec5 100644 --- a/com.twin.app.shoptime/src/views/HomePanel/PopularShow/PopularShow.jsx +++ b/com.twin.app.shoptime/src/views/HomePanel/PopularShow/PopularShow.jsx @@ -86,16 +86,25 @@ const PopularShow = ({ setDrawChk(true); }, [topInfos]); - useEffect(()=>{ + useEffect(()=>{ setShowInfos( recommendInfo?.filter( (item) => item.recommendTpCd === "POPULARSHOW" - ) + ) || [] ) },[recommendInfo]) useEffect(() => { - const recommendedData = showInfos?.[0].showInfos?.slice(0, 2).map((item) => ({ + if (!showInfos || showInfos.length === 0) { + const baseData = topInfos?.map((item) => ({ + ...item, + foryou: false, + })) || []; + setShowNewInfos(baseData); + return; + } + + const recommendedData = showInfos[0].showInfos?.slice(0, 2).map((item) => ({ ...item, foryou: true, })) || []; @@ -104,12 +113,14 @@ const PopularShow = ({ const baseData = topInfos?.filter( (item) => !recommendedPrdtIds.has(item.showId) - ).map((item) => ({ - ...item, - foryou: false, - })) || []; + ).map((item) => ({ + ...item, + foryou: false, + })) || []; + setShowNewInfos([...recommendedData, ...baseData]); - }, [topInfos, showInfos?.[0].showInfos]); + + }, [topInfos, showInfos]);