[251210] fix: DetailPanel,ProductAllSection API최적화-1

🕐 커밋 시간: 2025. 12. 10. 16:49:51

📊 변경 통계:
  • 총 파일: 1개
  • 추가: +49줄
  • 삭제: -43줄

📝 수정된 파일:
  ~ com.twin.app.shoptime/src/views/DetailPanel/ProductAllSection/ProductAllSection.jsx

🔧 주요 변경 내용:
  • 소규모 기능 개선
  • 코드 정리 및 최적화
This commit is contained in:
2025-12-10 16:49:51 +09:00
parent a2b29d219a
commit bc8317483f

View File

@@ -335,7 +335,7 @@ export default function ProductAllSection({
hasVideo
]);
useEffect(() => {
const fetchCouponData = useCallback(() => {
dispatch(
getProductCouponSearch({
patnrId: selectedPatnrId,
@@ -343,7 +343,14 @@ export default function ProductAllSection({
mbrNo: userNumber,
})
);
}, [dispatch]);
}, [selectedPatnrId, selectedPrdtId, userNumber, dispatch]);
useEffect(() => {
// 필수 값이 모두 있을 때만 호출
if (selectedPatnrId && selectedPrdtId) {
fetchCouponData();
}
}, [fetchCouponData]);
const getCouponCode = () => {
const snoArray = [];
@@ -383,7 +390,7 @@ export default function ProductAllSection({
setCouponTypes(idx);
dispatch(setShowPopup(Config.ACTIVE_POPUP.couponPopup));
},
[dispatch, popupVisible, promotions, userNumber]
[dispatch, userNumber, partnerCoupon]
);
const handleCouponTotDownload = useCallback(() => {
@@ -748,8 +755,10 @@ export default function ProductAllSection({
: baseMenu;
dispatch(sendLogGNB(menu));
}, [isBillingProductVisible, isGroupProductVisible, isTravelProductVisible, fromPanel?.fromYouMayLike]);
// sendLogGNB 전송 후 플래그 초기화 (1회 사용 후 비활성화)
useEffect(() => {
if (fromPanel?.fromYouMayLike === true) {
dispatch(updatePanel({
name: panel_names.DETAIL_PANEL,
@@ -761,7 +770,7 @@ export default function ProductAllSection({
}
}));
}
}, [fromPanel?.fromYouMayLike, isBillingProductVisible, isUnavailableProductVisible, isGroupProductVisible, isTravelProductVisible]); // BUY NOW 상태 변경 시 재실행
}, [fromPanel?.fromYouMayLike, dispatch, panelInfo]);
// sendLogProductDetail 로깅 - Source의 productData 변경 감지와 동일한 패턴
useEffect(() => {
@@ -793,9 +802,9 @@ export default function ProductAllSection({
tsvFlag: productData?.todaySpclFlag ?? "",
};
return () => dispatch(sendLogProductDetail(params));
dispatch(sendLogProductDetail(params));
}
}, [productData, entryMenuRef.current, panelInfo?.linkTpCd, isBillingProductVisible, isGroupProductVisible, isTravelProductVisible]); // productData 변경 시 재실행
}, [productData, panelInfo?.linkTpCd, isBillingProductVisible, isGroupProductVisible, isTravelProductVisible, dispatch]); // productData 변경 시 재실행
// [251115] 주석 처리: MediaPanel에서 이미 포커스 이동을 처리하므로
// ProductAllSection의 자동 포커스는 포커스 탈취를 일으킬 수 있음
@@ -1111,8 +1120,7 @@ export default function ProductAllSection({
return hasVideo && productVideoVersion === 1;
}, [hasVideo, productVideoVersion]);
const handleShopByMobileOpen = useCallback(
pipe(() => {
const handleShopByMobileOpen = useCallback(() => {
// sendLogShopByMobile - Source와 동일한 로깅 추가
if (productData && Object.keys(productData).length > 0) {
const { priceInfo, patncNm, patnrId, prdtId, prdtNm, brndNm, catNm } = productData;
@@ -1137,9 +1145,7 @@ export default function ProductAllSection({
}
setMobileSendPopupOpen(true); // 팝업 열기
}),
[setMobileSendPopupOpen]
);
}, [productData, dispatch]);
const shopByMobileId = useMemo(
() => SpotlightIds?.DETAIL_SHOPBYMOBILE || 'detail_shop_by_mobile',