261013_03_ENH: bfcache CTI 재로그인 확인용 임시 로그 제거

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-10-13 16:53:25 +09:00
parent 59c9238632
commit 81dd5165f3
2 changed files with 2 additions and 27 deletions

View File

@@ -43,30 +43,10 @@ export function useCtiConnection() {
// 뒤로/앞으로 가기로 bfcache에 들어갔다가 돌아오면 React 상태가 그대로 복원되어 위 effect가 다시 실행되지 않는다.
// 떠날 때 CTI 서버에 Logout, 돌아올 때 다시 Login 하여 새로고침 없이 전화걸기를 쓸 수 있게 한다.
useEffect(() => {
// TEMP_CTI_LOG: pagehide 시점 로그가 콘솔에 남지 않아, 떠날 때 정보를 sessionStorage에 남기고 돌아오거나 다시 로드될 때 출력한다.
const PAGEHIDE_DEBUG_KEY = "__cti_pagehide_debug"; // TEMP_CTI_LOG
const printLastPageHide = (from: string) => {
const saved = sessionStorage.getItem(PAGEHIDE_DEBUG_KEY);
if (!saved) return;
console.log(`[CTI][TEMP_LOG] last pagehide (${from}) ->`, JSON.parse(saved)); // TEMP_CTI_LOG
sessionStorage.removeItem(PAGEHIDE_DEBUG_KEY);
};
printLastPageHide("mount");
console.log("[CTI][TEMP_LOG] page lifecycle listeners registered"); // TEMP_CTI_LOG
const handlePageHide = (event: PageTransitionEvent) => {
console.log("[CTI][TEMP_LOG] pagehide, persisted =", event.persisted); // TEMP_CTI_LOG
sessionStorage.setItem(PAGEHIDE_DEBUG_KEY, JSON.stringify({
persisted: event.persisted,
at: new Date().toISOString(),
path: window.location.pathname,
connectionState: ctiClient.getConnectionState(),
})); // TEMP_CTI_LOG
if (event.persisted) ctiClient.suspendForPageHide();
};
const handlePageShow = (event: PageTransitionEvent) => {
console.log("[CTI][TEMP_LOG] pageshow, persisted =", event.persisted); // TEMP_CTI_LOG
printLastPageHide("pageshow");
if (event.persisted) ctiClient.resumeFromPageShow();
};

View File

@@ -769,12 +769,8 @@ const connectAndLogin = (params: CtiLoginParams) => {
const suspendForPageHide = () => {
if (!currentLoginParams) return;
stopReconnectLoop();
if (currentAgentLoginId && connectionState === "open") {
if (isCallInProgress()) {
console.log("[CTI][TEMP_LOG] pagehide logout skipped, call is in progress"); // TEMP_CTI_LOG
} else {
send({ ZCommand: "Logout", AgentLoginID: currentAgentLoginId });
}
if (currentAgentLoginId && connectionState === "open" && !isCallInProgress()) {
send({ ZCommand: "Logout", AgentLoginID: currentAgentLoginId });
}
teardownSocket();
};
@@ -784,7 +780,6 @@ const resumeFromPageShow = () => {
const params = currentLoginParams;
if (!params) return;
if (connectionState === "open" || connectionState === "connecting") return;
console.log("[CTI][TEMP_LOG] pageshow resume, reconnecting"); // TEMP_CTI_LOG
connectAndLogin(params);
};