From 06e3978321c207ae31ea060304b703632df21513 Mon Sep 17 00:00:00 2001 From: "jiwon93.son" Date: Tue, 18 Nov 2025 16:30:26 +0900 Subject: [PATCH] =?UTF-8?q?[shoptime-6105]=20Home=20/=20Live=20/=20Shop=20?= =?UTF-8?q?Now=20=EC=83=81=ED=92=88=20=EC=A7=84=EC=9E=85=20=ED=9B=84=20?= =?UTF-8?q?=EC=9D=B4=EC=A0=84=EB=B2=84=ED=8A=BC=EC=9C=BC=EB=A1=9C=20Home?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=8F=8C=EC=95=84=EA=B0=88=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20=ED=8F=AC=EC=BB=A4=EC=8B=B1=20=EC=82=AC=EB=9D=BC?= =?UTF-8?q?=EC=A7=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/HomePanel/HomeBanner/RandomUnit.jsx | 26 +++++++++---------- .../src/views/HomePanel/HomePanel.jsx | 17 +++++++++--- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/com.twin.app.shoptime/src/views/HomePanel/HomeBanner/RandomUnit.jsx b/com.twin.app.shoptime/src/views/HomePanel/HomeBanner/RandomUnit.jsx index 640fb66c..c45b6d79 100644 --- a/com.twin.app.shoptime/src/views/HomePanel/HomeBanner/RandomUnit.jsx +++ b/com.twin.app.shoptime/src/views/HomePanel/HomeBanner/RandomUnit.jsx @@ -437,20 +437,19 @@ export default function RandomUnit({ // 비디오 클릭 const videoClick = useCallback(() => { - const lastFocusedTargetId = getContainerId(Spotlight.getCurrent()); const currentSpot = Spotlight.getCurrent(); - if (lastFocusedTargetId) { - dispatch( - updateHomeInfo({ - name: panel_names.HOME_PANEL, - panelInfo: { - lastFocusedTargetId, - focusedContainerId: TEMPLATE_CODE_CONF.TOP, - currentSpot: currentSpot?.getAttribute("data-spotlight-id"), - }, - }) - ); - } + const currentSpotlightId = currentSpot?.getAttribute("data-spotlight-id") || spotlightId; + + dispatch( + updateHomeInfo({ + name: panel_names.HOME_PANEL, + panelInfo: { + lastFocusedTargetId: currentSpotlightId, + focusedContainerId: TEMPLATE_CODE_CONF.TOP, + currentSpot: currentSpotlightId, + }, + }) + ); dispatch( startVideoPlayer({ @@ -484,6 +483,7 @@ export default function RandomUnit({ randomDataRef, sendBannerLog, onBlur, + dispatch, ]); // 투데이즈 딜 가격 정보 diff --git a/com.twin.app.shoptime/src/views/HomePanel/HomePanel.jsx b/com.twin.app.shoptime/src/views/HomePanel/HomePanel.jsx index 242fc7fd..ab8999eb 100644 --- a/com.twin.app.shoptime/src/views/HomePanel/HomePanel.jsx +++ b/com.twin.app.shoptime/src/views/HomePanel/HomePanel.jsx @@ -131,6 +131,8 @@ const HomePanel = ({ isOnTop }) => { const isInitialRender = useRef(true); const verticalPagenatorRef = useRef(null); const currentSentMenuRef = useRef(null); + const lastRestoredIdRef = useRef(null); + const prevIsOnTopRef = useRef(isOnTop); useEffect(() => { if (nowMenu === "Home/Top") { @@ -562,14 +564,21 @@ const HomePanel = ({ isOnTop }) => { }, [dispatch]); useEffect(() => { + const justCameBack = !prevIsOnTopRef.current && isOnTop; + if ( - isOnTop && + justCameBack && panelInfo?.lastFocusedTargetId && - !panelInfo?.focusedContainerId + panelInfo.lastFocusedTargetId !== lastRestoredIdRef.current ) { - Spotlight.focus(panelInfo.lastFocusedTargetId); + lastRestoredIdRef.current = panelInfo.lastFocusedTargetId; + setTimeout(() => { + Spotlight.focus(panelInfo.lastFocusedTargetId); + }, 150); } - }, [isOnTop, panelInfo?.lastFocusedTargetId, panelInfo?.focusedContainerId]); + + prevIsOnTopRef.current = isOnTop; + }, [isOnTop, panelInfo?.lastFocusedTargetId]); useEffect(() => { return () => {