From 4904c6fb58e8b482c0d8a8bf16e0d90b37efdf9f Mon Sep 17 00:00:00 2001 From: optrader Date: Wed, 26 Nov 2025 14:16:13 +0900 Subject: [PATCH] [251126] fix: Log Migration - SearchPanel.new.v2.jsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐Ÿ• ์ปค๋ฐ‹ ์‹œ๊ฐ„: 2025. 11. 26. 14:16:12 ๐Ÿ“Š ๋ณ€๊ฒฝ ํ†ต๊ณ„: โ€ข ์ด ํŒŒ์ผ: 4๊ฐœ โ€ข ์ถ”๊ฐ€: +51์ค„ โ€ข ์‚ญ์ œ: -81์ค„ ๐Ÿ“ ์ˆ˜์ •๋œ ํŒŒ์ผ: ~ com.twin.app.shoptime/src/App/App.js ~ com.twin.app.shoptime/src/actions/commonActions.js ~ com.twin.app.shoptime/src/api/TAxios.js ~ com.twin.app.shoptime/src/views/SearchPanel/SearchPanel.new.v2.jsx ๐Ÿ”ง ์ฃผ์š” ๋ณ€๊ฒฝ ๋‚ด์šฉ: โ€ข ํ•ต์‹ฌ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง ๊ฐœ์„  โ€ข API ์„œ๋น„์Šค ๋ ˆ์ด์–ด ๊ฐœ์„  โ€ข ์†Œ๊ทœ๋ชจ ๊ธฐ๋Šฅ ๊ฐœ์„  โ€ข ์ฝ”๋“œ ์ •๋ฆฌ ๋ฐ ์ตœ์ ํ™” Performance: ์ฝ”๋“œ ์ตœ์ ํ™”๋กœ ์„ฑ๋Šฅ ๊ฐœ์„  ๊ธฐ๋Œ€ --- com.twin.app.shoptime/src/App/App.js | 37 +++------------- .../src/actions/commonActions.js | 41 ++++++++--------- com.twin.app.shoptime/src/api/TAxios.js | 8 +++- .../views/SearchPanel/SearchPanel.new.v2.jsx | 44 +++++++------------ 4 files changed, 50 insertions(+), 80 deletions(-) diff --git a/com.twin.app.shoptime/src/App/App.js b/com.twin.app.shoptime/src/App/App.js index 9f08a638..ba5275a8 100644 --- a/com.twin.app.shoptime/src/App/App.js +++ b/com.twin.app.shoptime/src/App/App.js @@ -45,7 +45,7 @@ import { pushPanel } from '../actions/panelActions'; import { enqueuePanelHistory } from '../actions/panelHistoryActions'; import NotSupportedVersion from '../components/NotSupportedVersion/NotSupportedVersion'; import ToastContainer from '../components/TToast/ToastContainer'; -import GlobalPopup from '../components/GlobalPopup/GlobalPopup'; + import usePrevious from '../hooks/usePrevious'; import { lunaTest } from '../lunaSend/lunaTest'; import { store } from '../store/store'; @@ -407,28 +407,7 @@ Spotlight.silentlyFocus = function (...args) { return ret; }; -const resolveSpotlightIdFromEvent = (event) => { - if (!event) return undefined; - const { detail, target } = event; - if (detail) { - if (detail.spotlightId) { - return detail.spotlightId; - } - if (detail.id) { - return detail.id; - } - if (detail.target && detail.target.dataset && detail.target.dataset.spotlightId) { - return detail.target.dataset.spotlightId; - } - } - - if (target && target.dataset && target.dataset.spotlightId) { - return target.dataset.spotlightId; - } - - return undefined; -}; // Spotlight Focus ์ถ”์  ๋กœ๊ทธ [251115] // DOM ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ๋กœ ๋Œ€์ฒด @@ -448,7 +427,7 @@ const resolveSpotlightIdFromEvent = (event) => { // }); // } -function AppBase(props) { +function AppBase(_props) { const dispatch = useDispatch(); const httpHeader = useSelector((state) => state.common.httpHeader); const httpHeaderRef = useRef(httpHeader); @@ -650,7 +629,7 @@ function AppBase(props) { clearLaunchParams(); } }, - [dispatch] + [/* dispatch */] ); const handleRelaunchEvent = useCallback(() => { @@ -704,7 +683,7 @@ function AppBase(props) { if (typeof window === 'object' && window.PalmSystem) { window.PalmSystem.activate(); } - }, [initService, introTermsAgreeRef, dispatch]); + }, [initService, introTermsAgreeRef /*, dispatch */]); const visibilityChanged = useCallback(() => { // console.log('document is hidden', document.hidden); @@ -748,7 +727,7 @@ function AppBase(props) { }, [dispatch]); useEffect(() => { - const keyDownEvent = (event) => { + const keyDownEvent = (_event) => { dispatch(changeAppStatus({ cursorVisible: false })); Spotlight.setPointerMode(false); }; @@ -757,7 +736,7 @@ function AppBase(props) { let lastMoveTime = 0; const THROTTLE_MS = 100; - const mouseMoveEvent = (event) => { + const mouseMoveEvent = (_event) => { const now = Date.now(); if (now - lastMoveTime < THROTTLE_MS) { // throttle ๊ธฐ๊ฐ„ ๋‚ด์—๋Š” hideCursor๋งŒ ์žฌ์‹œ์ž‘ @@ -810,9 +789,7 @@ function AppBase(props) { let userDataChanged = false; if (JSON.stringify(loginUserDataRef.current) !== JSON.stringify(loginUserData)) { userDataChanged = true; - } - if (!httpHeader || !deviceId) { - } else if (userDataChanged || httpHeaderRef.current === null) { +} else if (userDataChanged || httpHeaderRef.current === null) { //๊ณ„์ •์ •๋ณด ๋ณ€๊ฒฝ์‹œ ๋˜๋Š” ์ดˆ๊ธฐ ๋กœ๋”ฉ์‹œ if (!httpHeader) { dispatch( diff --git a/com.twin.app.shoptime/src/actions/commonActions.js b/com.twin.app.shoptime/src/actions/commonActions.js index 4523b080..2d484d88 100644 --- a/com.twin.app.shoptime/src/actions/commonActions.js +++ b/com.twin.app.shoptime/src/actions/commonActions.js @@ -7,9 +7,7 @@ import Spotlight from '@enact/spotlight'; import appinfo from '../../webos-meta/appinfo.json'; import appinfo35 from '../../webos-meta/appinfo35.json'; import appinfo79 from '../../webos-meta/appinfo79.json'; -import { handleBypassLink } from '../App/bypassLinkHandler'; import * as lunaSend from '../lunaSend'; -import { initialLocalSettings } from '../reducers/localSettingsReducer'; import * as Config from '../utils/Config'; import * as HelperMethods from '../utils/helperMethods'; import { types } from './actionTypes'; @@ -17,7 +15,7 @@ import { createDebugHelpers } from '../utils/debug'; // ๋””๋ฒ„๊ทธ ํ—ฌํผ ์„ค์ • const DEBUG_MODE = false; -const { dlog, dwarn, derror } = createDebugHelpers(DEBUG_MODE); +const { dlog, derror } = createDebugHelpers(DEBUG_MODE); // ======= // import appinfo from "../../webos-meta/appinfo.json"; // import appinfo35 from "../../webos-meta/appinfo35.json"; @@ -94,7 +92,7 @@ export const toggleOptionalTermsConfirm = (selected) => ({ payload: selected, }); -export const setExitApp = () => (dispatch, getState) => { +export const setExitApp = () => (dispatch) => { dispatch({ type: types.SET_EXIT_APP }); dlog('Exiting App...'); @@ -124,13 +122,13 @@ export const alertToast = (payload) => (dispatch, getState) => { } }; -export const getSystemSettings = () => (dispatch, getState) => { +export const getSystemSettings = () => (dispatch) => { dlog('getSystemSettings '); lunaSend.getSystemSettings( { category: 'caption', keys: ['captionEnable'] }, { - onSuccess: (res) => {}, - onFailure: (err) => {}, + onSuccess: () => {}, + onFailure: () => {}, onComplete: (res) => { dlog('getSystemSettings onComplete', res); if (res && res.settings) { @@ -148,7 +146,7 @@ export const getSystemSettings = () => (dispatch, getState) => { ); }; -export const getHttpHeaderForServiceRequest = (onComplete) => (dispatch, getState) => { +export const getHttpHeaderForServiceRequest = () => (dispatch, getState) => { dlog('getHttpHeaderForServiceRequest '); const { serverType, ricCodeSetting, languageSetting } = getState().localSettings; lunaSend.getHttpHeaderForServiceRequest({ @@ -267,10 +265,9 @@ export const getHttpHeaderForServiceRequest = (onComplete) => (dispatch, getStat const mbrNo = res['X-User-Number']; lunaSend.getLoginUserData(parameters, { - onSuccess: (res) => { - const userId = res.id ?? ''; - const userNumber = res.lastSignInUserNo; - const profileNick = res.profileNick || userId.split('@')[0]; + onSuccess: (loginRes) => { + const userId = loginRes.id ?? ''; + const profileNick = loginRes.profileNick || userId.split('@')[0]; dispatch( getLoginUserData({ userId, @@ -288,7 +285,7 @@ export const getHttpHeaderForServiceRequest = (onComplete) => (dispatch, getStat }); }; -export const getDeviceId = (onComplete) => (dispatch, getState) => { +export const getDeviceId = (onComplete) => (dispatch) => { lunaSend.getDeviceId( { idType: ['LGUDID'] }, { @@ -466,7 +463,7 @@ export const setFocus = (spotlightId) => ({ payload: spotlightId, }); -export const focusElement = (spotlightId) => (dispatch, getState) => { +export const focusElement = (spotlightId) => (dispatch) => { dispatch(setFocus(spotlightId)); if (typeof window === 'object') { @@ -488,7 +485,7 @@ export const cancelFocusElement = () => () => { let broadcastTimer = null; export const sendBroadCast = ({ type, moreInfo }) => - (dispatch, getState) => { + (dispatch) => { clearTimeout(broadcastTimer); dispatch(changeBroadcastEvent({ type, moreInfo })); broadcastTimer = setTimeout(() => { @@ -545,7 +542,7 @@ export const addReservation = (data) => (dispatch) => { }); }; -export const deleteReservationCallback = (scheduleIdList) => (dispatch) => { +export const deleteReservationCallback = (scheduleIdList) => () => { lunaSend.deleteReservationCallback(scheduleIdList, { onSuccess: (res) => { // dispatch(alertToast("success" + JSON.stringify(res))); @@ -636,8 +633,8 @@ export const showError = export const deleteOldDb8Datas = () => (dispatch) => { for (let i = 1; i < 10; i++) { lunaSend.deleteOldDb8(i, { - onSuccess: (res) => {}, - onFailure: (err) => {}, + onSuccess: () => {}, + onFailure: () => {}, }); } dispatch(changeLocalSettings({ oldDb8Deleted: true })); @@ -683,7 +680,7 @@ let updateNetworkStateJob = new Job((dispatch, connected) => { dispatch(changeAppStatus({ isInternetConnected: connected })); }); -export const getConnectionStatus = () => (dispatch, getState) => { +export const getConnectionStatus = () => (dispatch) => { lunaSend.getConnectionStatus({ onSuccess: (res) => { dlog('lunasend getConnectionStatus', res); @@ -712,7 +709,7 @@ export const getConnectionStatus = () => (dispatch, getState) => { }; // macAddress -export const getConnectionInfo = () => (dispatch, getState) => { +export const getConnectionInfo = () => (dispatch) => { lunaSend.getConnectionInfo({ onSuccess: (res) => { dlog('lunasend getConnectionStatus', res); @@ -734,7 +731,7 @@ export const getConnectionInfo = () => (dispatch, getState) => { }); }; -export const disableNotification = () => (dispatch, getState) => { +export const disableNotification = () => { lunaSend.disableNotification({ onSuccess: (res) => { dlog('lunasend disable notification success', res); @@ -748,7 +745,7 @@ export const disableNotification = () => (dispatch, getState) => { }); }; -export const enableNotification = () => (dispatch, getState) => { +export const enableNotification = () => { lunaSend.enableNotification({ onSuccess: (res) => { dlog('lunasend enable notification success', res); diff --git a/com.twin.app.shoptime/src/api/TAxios.js b/com.twin.app.shoptime/src/api/TAxios.js index b7b68f47..172b4c7d 100644 --- a/com.twin.app.shoptime/src/api/TAxios.js +++ b/com.twin.app.shoptime/src/api/TAxios.js @@ -348,8 +348,14 @@ export const TAxiosAdvancedPromise = ( clearTimeout(timeoutId); console.error(`TAxiosPromise error on attempt ${attempts} for ${baseUrl}:`, error); + // Check if the error is due to token expiration + // TAxios already handles token refresh and queueing for these codes (401, 402, 501) + // So we should NOT retry immediately in this loop, but let TAxios handle it. + const retCode = error?.data?.retCode; + const isTokenError = retCode === 401 || retCode === 402 || retCode === 501; + // ์žฌ์‹œ๋„ ๋กœ์ง - if (attempts < maxAttempts) { + if (attempts < maxAttempts && !isTokenError) { console.log(`Retrying in ${retryDelay}ms... (${attempts}/${maxAttempts})`); setTimeout(() => { attemptRequest(); diff --git a/com.twin.app.shoptime/src/views/SearchPanel/SearchPanel.new.v2.jsx b/com.twin.app.shoptime/src/views/SearchPanel/SearchPanel.new.v2.jsx index 046fb8ef..a976248d 100644 --- a/com.twin.app.shoptime/src/views/SearchPanel/SearchPanel.new.v2.jsx +++ b/com.twin.app.shoptime/src/views/SearchPanel/SearchPanel.new.v2.jsx @@ -1987,35 +1987,25 @@ export default function SearchPanel({ panelInfo, isOnTop, spotlightId }) { /** * LOG ์šฉ๋„, * ๊ฒ€์ƒ‰ ์‹œ ๋กœ๊ทธ๋ฅผ ๋ณด๋‚ด๋Š” ์šฉ๋„์˜ ์ดํŽ™ํŠธ - * ์šฐ์„  ์ฃผ์„์ฒ˜๋ฆฌ (๊ณ„์†๋ณด๋‚ด๋Š”๋ถ€๋ถ„์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ ํ•„์š”) */ - // useEffect(() => { - // const result = Object.values(searchDatas).reduce((acc, curr) => { - // return acc + curr.length; - // }, 0); + useEffect(() => { + const result = Object.values(searchDatas).reduce((acc, curr) => { + return acc + curr.length; + }, 0); - // if (searchQuery) { - // dispatch( - // sendLogTotalRecommend({ - // query: searchQuery, - // searchType: searchPerformed ? 'query' : 'keyword', - // result: result, - // contextName: LOG_CONTEXT_NAME.SEARCH, - // messageId: LOG_MESSAGE_ID.SEARCH_ITEM, - // }) - // ); - - // // ๊ฒ€์ƒ‰ ์™„๋ฃŒ ํ›„ ๊ฒฐ๊ณผ์— ๋”ฐ๋ฅธ Toast ํ‘œ์‹œ - // // if (searchPerformed && searchQuery.trim()) { - // // if (result > 0) { - // // dispatch(showSearchSuccessToast(searchQuery, result)); - // // } else { - // // dispatch(showSearchErrorToast(searchQuery)); - // // } - // // } - // } - // // eslint-disable-next-line react-hooks/exhaustive-deps - // }, [searchDatas, searchPerformed, searchQuery]); + if (searchQuery) { + dispatch( + sendLogTotalRecommend({ + query: searchQuery, + searchType: searchPerformed ? 'query' : 'keyword', + result: result, + contextName: LOG_CONTEXT_NAME.SEARCH, + messageId: LOG_MESSAGE_ID.SEARCH_ITEM, + }) + ); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [searchDatas, searchPerformed, searchQuery]); /** * clean up ์šฉ๋„