[20250724] 서버/국가 변경시 리로딩 해결
This commit is contained in:
@@ -71,71 +71,6 @@ import { sendLogTotalRecommend } from "../actions/logActions";
|
||||
// } from "../utils/focus-monitor";
|
||||
// import { PanelHoc } from "../components/TPanel/TPanel";
|
||||
|
||||
// ===== 템플릿 설정 함수들 =====
|
||||
const applyTemplateSettings = (templateName) => {
|
||||
const templates = {
|
||||
// eic 서버 + GB 국가
|
||||
"eic-gb": {
|
||||
serverType: "qt2",
|
||||
ricCodeSetting: "eic",
|
||||
languageSetting: "GB"
|
||||
},
|
||||
// aic 서버 + US 국가
|
||||
"aic-us": {
|
||||
serverType: "qt2",
|
||||
ricCodeSetting: "aic",
|
||||
languageSetting: "US"
|
||||
},
|
||||
// ruc 서버 + RU 국가
|
||||
"ruc-ru": {
|
||||
serverType: "qt2",
|
||||
ricCodeSetting: "ruc",
|
||||
languageSetting: "RU"
|
||||
},
|
||||
// 기본 설정 (system)
|
||||
"default": {
|
||||
serverType: "system",
|
||||
ricCodeSetting: "system",
|
||||
languageSetting: "system"
|
||||
}
|
||||
};
|
||||
|
||||
return templates[templateName] || templates["default"];
|
||||
};
|
||||
|
||||
// 템플릿 설정 적용 훅
|
||||
const useTemplateSettings = () => {
|
||||
const dispatch = useDispatch();
|
||||
const currentLocalSettings = useSelector((state) => state.localSettings);
|
||||
|
||||
const applyTemplate = useCallback((templateName) => {
|
||||
const settings = applyTemplateSettings(templateName);
|
||||
console.log(`[Template] Applying template: ${templateName}`, settings);
|
||||
|
||||
// 현재 설정과 비교하여 변경사항이 있을 때만 적용
|
||||
const hasChanges = Object.keys(settings).some(key =>
|
||||
currentLocalSettings[key] !== settings[key]
|
||||
);
|
||||
|
||||
if (hasChanges) {
|
||||
console.log("[Template] Settings changed, applying new template");
|
||||
dispatch(changeLocalSettings(settings));
|
||||
|
||||
// 설정 변경 후 페이지 새로고침
|
||||
setTimeout(() => {
|
||||
if (typeof window === "object") {
|
||||
window.location.reload();
|
||||
}
|
||||
}, 500);
|
||||
} else {
|
||||
console.log("[Template] No changes detected, skipping template application");
|
||||
}
|
||||
}, [dispatch, currentLocalSettings]);
|
||||
|
||||
return { applyTemplate };
|
||||
};
|
||||
// ===== 템플릿 설정 함수들 끝 =====
|
||||
|
||||
let foreGroundChangeTimer = null;
|
||||
|
||||
// 기존 콘솔 메서드를 백업
|
||||
@@ -219,9 +154,6 @@ function AppBase(props) {
|
||||
// const termsFlag = useSelector((state) => state.common.termsFlag);
|
||||
const termsData = useSelector((state) => state.home.termsData);
|
||||
|
||||
// 템플릿 설정 훅 사용
|
||||
const { applyTemplate } = useTemplateSettings();
|
||||
|
||||
useEffect(() => {
|
||||
// Chromium68 호환성을 위해 Optional Chaining 제거
|
||||
if (termsData && termsData.data && termsData.data.terms) {
|
||||
@@ -259,24 +191,6 @@ function AppBase(props) {
|
||||
}
|
||||
}, [oldDb8Deleted, dispatch]);
|
||||
|
||||
// ===== 템플릿 설정 적용 =====
|
||||
// 테스트 시에만 아래 주석을 해제하고 원하는 템플릿을 선택하세요
|
||||
// 사용법: 원하는 템플릿의 주석을 해제하면 앱 시작 시 해당 설정이 적용됩니다
|
||||
useEffect(() => {
|
||||
// 앱 초기화가 완료된 후 템플릿 설정 적용
|
||||
if (httpHeaderRef.current) {
|
||||
const timer = setTimeout(() => {
|
||||
// applyTemplate("eic-gb"); // eic 서버 + GB 국가
|
||||
// applyTemplate("aic-us"); // aic 서버 + US 국가
|
||||
// applyTemplate("ruc-ru"); // ruc 서버 + RU 국가
|
||||
applyTemplate("default"); // 기본 설정 (system)
|
||||
}, 2000); // 2초 후 적용
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}
|
||||
}, [applyTemplate, httpHeaderRef.current]);
|
||||
// ===== 템플릿 설정 끝 =====
|
||||
|
||||
const hideCursor = useRef(
|
||||
new Job((func) => {
|
||||
func();
|
||||
|
||||
@@ -71,9 +71,14 @@ export default function DebugPanel({ spotlightId }) {
|
||||
return;
|
||||
} else {
|
||||
dispatch(changeLocalSettings({ serverType: type, ricCodeSetting: "system" }));
|
||||
console.log("[DebugPanel] Server setting changed to:", type);
|
||||
// 즉시 리로드하지 않고 3초 후 자동 리로드
|
||||
setTimeout(() => {
|
||||
if (typeof window === "object") {
|
||||
console.log("[DebugPanel] Reloading after server change...");
|
||||
window.location.reload();
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
},
|
||||
[dispatch, localSettings]
|
||||
@@ -82,9 +87,14 @@ export default function DebugPanel({ spotlightId }) {
|
||||
const onChangeServerRic = useCallback(
|
||||
(type) => () => {
|
||||
dispatch(changeLocalSettings({ ricCodeSetting: type }));
|
||||
console.log("[DebugPanel] RicCode setting changed to:", type);
|
||||
// 즉시 리로드하지 않고 3초 후 자동 리로드
|
||||
setTimeout(() => {
|
||||
if (typeof window === "object") {
|
||||
console.log("[DebugPanel] Reloading after ricCode change...");
|
||||
window.location.reload();
|
||||
}
|
||||
}, 3000);
|
||||
},
|
||||
[dispatch, localSettings]
|
||||
);
|
||||
@@ -92,9 +102,14 @@ export default function DebugPanel({ spotlightId }) {
|
||||
const onChangeLanguage = useCallback(
|
||||
(type) => () => {
|
||||
dispatch(changeLocalSettings({ languageSetting: type }));
|
||||
console.log("[DebugPanel] Language setting changed to:", type);
|
||||
// 즉시 리로드하지 않고 3초 후 자동 리로드
|
||||
setTimeout(() => {
|
||||
if (typeof window === "object") {
|
||||
console.log("[DebugPanel] Reloading after language change...");
|
||||
window.location.reload();
|
||||
}
|
||||
}, 3000);
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
@@ -368,17 +368,17 @@ export default function HomeBanner({
|
||||
return null;
|
||||
}, [bannerDataList]);
|
||||
|
||||
useEffect(() => {
|
||||
if (firstSpot && defaultFocus && popupVisible === false) {
|
||||
setTimeout(() => {
|
||||
Spotlight.focus(defaultFocus);
|
||||
}, 0);
|
||||
}
|
||||
// useEffect(() => {
|
||||
// if (firstSpot && defaultFocus && popupVisible === false) {
|
||||
// setTimeout(() => {
|
||||
// Spotlight.focus(defaultFocus);
|
||||
// }, 0);
|
||||
// }
|
||||
|
||||
if (defaultFocus) {
|
||||
dispatch(setDefaultFocus(defaultFocus));
|
||||
}
|
||||
}, [defaultFocus, dispatch, popupVisible]);
|
||||
// if (defaultFocus) {
|
||||
// dispatch(setDefaultFocus(defaultFocus));
|
||||
// }
|
||||
// }, [defaultFocus, dispatch, popupVisible]);
|
||||
|
||||
// 테스트용 팝업 표시
|
||||
// useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user