[251029] fix: HowAboutTheseResponse 배경상품표시

🕐 커밋 시간: 2025. 10. 29. 20:03:57

📊 변경 통계:
  • 총 파일: 3개
  • 추가: +12줄
  • 삭제: -5줄

📁 추가된 파일:
  + com.twin.app.shoptime/src/utils/browserUtils.js

📝 수정된 파일:
  ~ com.twin.app.shoptime/src/views/SearchPanel/SearchPanel.new.v2.jsx
  ~ com.twin.app.shoptime/src/views/SearchPanel/SearchResults.new.v2.jsx

🔧 주요 변경 내용:
  • 공통 유틸리티 함수 최적화
This commit is contained in:
2025-10-29 20:03:57 +09:00
parent 274b7a8245
commit eda52c9378
3 changed files with 49 additions and 5 deletions

View File

@@ -0,0 +1,37 @@
// src/utils/browserUtils.js
// Browser and platform detection helpers focused on legacy Chromium builds.
/* global navigator */
let cachedIsWebOsChromium68;
const getUserAgent = () => {
if (typeof navigator === 'undefined' || !navigator.userAgent) {
return '';
}
return navigator.userAgent;
};
/**
* Detects WebOS TV 22 devices that still ship with Chromium 68.
* These builds expose a second native scrollbar that needs to be visually suppressed.
* @returns {boolean}
*/
export const isWebOsChromium68 = () => {
if (cachedIsWebOsChromium68 !== undefined) {
return cachedIsWebOsChromium68;
}
const userAgent = getUserAgent();
if (!userAgent) {
cachedIsWebOsChromium68 = false;
return cachedIsWebOsChromium68;
}
// WebOS user agents use "Web0S" (zero) in newer firmware strings; keep a broader check just in case.
const isWebOs = /Web0S\/[\d.]+/i.test(userAgent) || /webos/i.test(userAgent);
const isChrome68 = /Chrome\/68\./i.test(userAgent);
cachedIsWebOsChromium68 = isWebOs && isChrome68;
return cachedIsWebOsChromium68;
};

View File

@@ -1069,6 +1069,8 @@ export default function SearchPanel({ panelInfo, isOnTop, spotlightId }) {
// API 호출 전에 이전 데이터 초기화
setIsShopperHousePending(true);
// 🎯 REF 활용: clearShopperHouseData() 전에 현재 데이터를 ref에 임시 저장
shopperHouseDataRef.current = shopperHouseData;
dispatch(clearShopperHouseData());
// Redux state 업데이트를 위해 약간의 지연 후 API 호출
@@ -1234,6 +1236,7 @@ export default function SearchPanel({ panelInfo, isOnTop, spotlightId }) {
itemInfo={searchDatas.item}
showInfo={searchDatas.show}
shopperHouseInfo={shopperHouseData}
fallbackShopperHouseData={shopperHouseDataRef.current}
shopperHouseSearchId={shopperHouseSearchId}
shopperHouseRelativeQueries={shopperHouseRelativeQueries}
keywordClick={handleKeywordClick}

View File

@@ -87,6 +87,7 @@ const SearchResultsNew = ({
showInfo,
themeInfo,
shopperHouseInfo,
fallbackShopperHouseData = null,
shopperHouseSearchId = null,
shopperHouseRelativeQueries = [],
onRelativeQueryClick,
@@ -96,15 +97,18 @@ const SearchResultsNew = ({
const dispatch = useDispatch();
// ShopperHouse 데이터를 ItemCard 형식으로 변환
const convertedShopperHouseItems = useMemo(() => {
// 🎯 Fallback 로직: shopperHouseInfo가 없으면 fallbackShopperHouseData 사용
const targetData = shopperHouseInfo || fallbackShopperHouseData;
if (
!shopperHouseInfo ||
!shopperHouseInfo.results ||
shopperHouseInfo.results.length === 0
!targetData ||
!targetData.results ||
targetData.results.length === 0
) {
return null;
}
const resultData = shopperHouseInfo.results[0];
const resultData = targetData.results[0];
const docs = resultData.docs || [];
return docs.map((doc) => {
@@ -132,7 +136,7 @@ const SearchResultsNew = ({
rangeType: resultData.rangeType || '',
};
});
}, [shopperHouseInfo]);
}, [shopperHouseInfo, fallbackShopperHouseData]);
const getButtonTabList = () => {
// ShopperHouse 데이터가 있으면 그것을 사용, 없으면 기존 검색 결과 사용