From 81dd5165f3fadff3fa3092764bd0d9a5a3b7eab4 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Tue, 13 Oct 2026 16:53:25 +0900 Subject: [PATCH] =?UTF-8?q?261013=5F03=5FENH:=20bfcache=20CTI=20=EC=9E=AC?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=ED=99=95=EC=9D=B8=EC=9A=A9=20?= =?UTF-8?q?=EC=9E=84=EC=8B=9C=20=EB=A1=9C=EA=B7=B8=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 (1M context) --- src/hooks/useCtiConnection.ts | 20 -------------------- src/lib/cti/ctiClient.ts | 9 ++------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/src/hooks/useCtiConnection.ts b/src/hooks/useCtiConnection.ts index fce2a7e..73be72e 100644 --- a/src/hooks/useCtiConnection.ts +++ b/src/hooks/useCtiConnection.ts @@ -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(); }; diff --git a/src/lib/cti/ctiClient.ts b/src/lib/cti/ctiClient.ts index 372e42a..9fbf4bc 100644 --- a/src/lib/cti/ctiClient.ts +++ b/src/lib/cti/ctiClient.ts @@ -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); };