[251105] feat: CheckOutPanel에서 DetailPanel으로 복귀 시 데이터 재로드

- CheckOutPanel Back/Cancel 버튼에서 DetailPanel에 shouldReload 신호 전달
- DetailPanel에 panelShouldReload 플래그 추가
- panelShouldReload useEffect로 데이터 초기화 및 재로딩 구현
- DetailPanel 스택 유지로 자연스러운 네비게이션 제공

Generated with coding tools

Co-Authored-By: Dev Team <noreply@dev.team>
This commit is contained in:
2025-11-05 08:54:20 +09:00
parent 2d58f7b35f
commit bb141c2b01
2 changed files with 67 additions and 8 deletions

View File

@@ -409,13 +409,20 @@ export default function CheckOutPanel({ panelInfo }) {
}, [activePopup]);
const onBackClick = useCallback(() => {
console.log('[BuyOption][CheckOutPanel] onBackClick called - dispatching popPanel');
console.log('[BuyOption][CheckOutPanel] Current panels before pop:', panels?.map((p) => p.name));
console.log('[CheckOutPanel] onBackClick - Sending reload signal to DetailPanel');
// 확실한 popPanel 호출 - CheckOutPanel만 제거
// DetailPanel에 재시작 신호 전달
dispatch(updatePanel({
name: Config.panel_names.DETAIL_PANEL,
panelInfo: {
shouldReload: true,
}
}));
// CheckOutPanel 제거
dispatch(popPanel(Config.panel_names.CHECKOUT_PANEL));
console.log('[BuyOption][CheckOutPanel] popPanel dispatched for CHECKOUT_PANEL');
console.log('[CheckOutPanel] popPanel dispatched for CHECKOUT_PANEL');
}, [dispatch, panels]);
const toggleOrderSideBar = useCallback(() => {
@@ -538,14 +545,21 @@ export default function CheckOutPanel({ panelInfo }) {
}
if (!orderSideBarOpen && !offerSideBarOpen) {
console.log('[BuyOption][CheckOutPanel] onCancelCheckoutPanel - calling popPanel for CHECKOUT_PANEL');
console.log('[BuyOption][CheckOutPanel] Current panels before cancel pop:', panels?.map((p) => p.name));
console.log('[CheckOutPanel] onCancelCheckoutPanel - Sending reload signal to DetailPanel');
// 확실한 popPanel 호출 - CheckOutPanel만 제거
// DetailPanel에 재시작 신호 전달
dispatch(updatePanel({
name: Config.panel_names.DETAIL_PANEL,
panelInfo: {
shouldReload: true,
}
}));
// CheckOutPanel 제거
dispatch(popPanel(Config.panel_names.CHECKOUT_PANEL));
e.stopPropagation();
console.log('[BuyOption][CheckOutPanel] popPanel dispatched for CHECKOUT_PANEL from cancel');
console.log('[CheckOutPanel] popPanel dispatched for CHECKOUT_PANEL from cancel');
}
},
[orderSideBarOpen, offerSideBarOpen, dispatch, panels]

View File

@@ -96,6 +96,10 @@ export default function DetailPanel({ panelInfo, isOnTop, spotlightId }) {
() => fp.pipe(() => panelInfo, fp.get('bgVideoInfo'), fp.defaultTo(null))(),
[panelInfo]
);
const panelShouldReload = useMemo(
() => fp.pipe(() => panelInfo, fp.get('shouldReload'), fp.defaultTo(false))(),
[panelInfo]
);
const productPmtSuptYn = useMemo(
() => fp.pipe(() => productData, fp.get('pmtSuptYn'))(),
[productData]
@@ -383,6 +387,47 @@ export default function DetailPanel({ panelInfo, isOnTop, spotlightId }) {
};
}, [dispatch]);
// CheckOutPanel에서 돌아올 때 DetailPanel 재시작
useEffect(() => {
if (panelShouldReload) {
console.log('[DetailPanel] Reloading panel data...');
// 기존 데이터 초기화
dispatch(clearProductDetail());
// 데이터 다시 로딩
const isThemeType = panelType === 'theme';
if (isThemeType && panelCurationId) {
dispatch(
getThemeCurationDetailInfo({
patnrId: panelPatnrId,
curationId: panelCurationId,
bgImgNo: panelBgImgNo,
})
);
} else if (panelPrdtId && !panelCurationId) {
dispatch(
getMainCategoryDetail({
patnrId: panelPatnrId,
prdtId: panelPrdtId,
liveReqFlag: panelLiveReqFlag || 'N',
})
);
}
// 재시작 플래그 제거
dispatch(
updatePanel({
name: panel_names.DETAIL_PANEL,
panelInfo: { shouldReload: false }
})
);
console.log('[DetailPanel] Reload complete');
}
}, [panelShouldReload, dispatch, panelType, panelPatnrId, panelCurationId, panelBgImgNo, panelPrdtId, panelLiveReqFlag]);
// 최근 본 상품 트리거 예시:
// useEffect(() => {
// if (panelInfo && panelInfo.patnrId && panelInfo.prdtId) {