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