261013_03_ENH: bfcache CTI 재로그인 확인용 임시 로그 제거
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,30 +43,10 @@ export function useCtiConnection() {
|
|||||||
// 뒤로/앞으로 가기로 bfcache에 들어갔다가 돌아오면 React 상태가 그대로 복원되어 위 effect가 다시 실행되지 않는다.
|
// 뒤로/앞으로 가기로 bfcache에 들어갔다가 돌아오면 React 상태가 그대로 복원되어 위 effect가 다시 실행되지 않는다.
|
||||||
// 떠날 때 CTI 서버에 Logout, 돌아올 때 다시 Login 하여 새로고침 없이 전화걸기를 쓸 수 있게 한다.
|
// 떠날 때 CTI 서버에 Logout, 돌아올 때 다시 Login 하여 새로고침 없이 전화걸기를 쓸 수 있게 한다.
|
||||||
useEffect(() => {
|
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) => {
|
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();
|
if (event.persisted) ctiClient.suspendForPageHide();
|
||||||
};
|
};
|
||||||
const handlePageShow = (event: PageTransitionEvent) => {
|
const handlePageShow = (event: PageTransitionEvent) => {
|
||||||
console.log("[CTI][TEMP_LOG] pageshow, persisted =", event.persisted); // TEMP_CTI_LOG
|
|
||||||
printLastPageHide("pageshow");
|
|
||||||
if (event.persisted) ctiClient.resumeFromPageShow();
|
if (event.persisted) ctiClient.resumeFromPageShow();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -769,13 +769,9 @@ const connectAndLogin = (params: CtiLoginParams) => {
|
|||||||
const suspendForPageHide = () => {
|
const suspendForPageHide = () => {
|
||||||
if (!currentLoginParams) return;
|
if (!currentLoginParams) return;
|
||||||
stopReconnectLoop();
|
stopReconnectLoop();
|
||||||
if (currentAgentLoginId && connectionState === "open") {
|
if (currentAgentLoginId && connectionState === "open" && !isCallInProgress()) {
|
||||||
if (isCallInProgress()) {
|
|
||||||
console.log("[CTI][TEMP_LOG] pagehide logout skipped, call is in progress"); // TEMP_CTI_LOG
|
|
||||||
} else {
|
|
||||||
send({ ZCommand: "Logout", AgentLoginID: currentAgentLoginId });
|
send({ ZCommand: "Logout", AgentLoginID: currentAgentLoginId });
|
||||||
}
|
}
|
||||||
}
|
|
||||||
teardownSocket();
|
teardownSocket();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -784,7 +780,6 @@ const resumeFromPageShow = () => {
|
|||||||
const params = currentLoginParams;
|
const params = currentLoginParams;
|
||||||
if (!params) return;
|
if (!params) return;
|
||||||
if (connectionState === "open" || connectionState === "connecting") return;
|
if (connectionState === "open" || connectionState === "connecting") return;
|
||||||
console.log("[CTI][TEMP_LOG] pageshow resume, reconnecting"); // TEMP_CTI_LOG
|
|
||||||
connectAndLogin(params);
|
connectAndLogin(params);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user