[옵션 에러 관련 처리]

- BuyOption.jsx 수정
 - buy option 부분 클릭시 에러뜨는부분에 대한 수정.
This commit is contained in:
junghoon86.park
2025-10-30 12:56:38 +09:00
parent beca25fb3a
commit b727499e4b

View File

@@ -246,22 +246,25 @@ const BuyOption = ({
// isSpotlight이 true이고 SingleOption 동작이 필요한 경우 요부분
if (productInfo?.optProdYn === 'N') {
Spotlight.focus('buy-option-buy-now-button');
} else if (
productOptionInfos &&
productOptionInfos.length > 1 &&
productInfo?.optProdYn === 'Y'
) {
Spotlight.focus('buy-option-first-dropdown');
} else if (
productOptionInfos[selectedBtnOptIdx]?.prdtOptDtl &&
productOptionInfos[selectedBtnOptIdx]?.prdtOptDtl.length > 1 &&
productInfo?.optProdYn === 'Y'
) {
Spotlight.focus('buy-option-second-dropdown');
} else if (productInfo?.optProdYn === 'Y') {
if(
productOptionInfos &&
productOptionInfos?.length > 1
){
Spotlight.focus('buy-option-first-dropdown');
} else if (
productOptionInfos?.legnth > 0 &&
productOptionInfos[selectedBtnOptIdx]?.prdtOptDtl &&
productOptionInfos[selectedBtnOptIdx]?.prdtOptDtl.length > 1
){
Spotlight.focus('buy-option-second-dropdown');
} else {
Spotlight.focus('buy-option-buy-now-button');
}
} else {
Spotlight.focus('buy-option-buy-now-button');
}
}, [productOptionInfos, productInfo]);
}, [productOptionInfos?.length, productInfo?.length]);
// checkOutValidate 콜백 함수 (SingleOption과 동일한 로직)
function checkOutValidate(response) {
@@ -693,11 +696,11 @@ const BuyOption = ({
<div className={styles.buy_option__left_section}>
{/* 동적 옵션 렌더링 */}
{productOptionInfos &&
productOptionInfos.length > 0 &&
productOptionInfos?.length > 0 &&
productInfo?.optProdYn === 'Y' && (
<>
{/* 첫번째 옵션 (여러 옵션이 있을 때만) */}
{productOptionInfos.length > 1 && (
{productOptionInfos?.length > 1 && (
<div className={styles.buy_option__option_row}>
<div className={styles.buy_option__option_label}>
<div className={styles.buy_option__label_text}>