From c8cbcfbdbc6498d4e720bcdd40b2b10ea5b18ca6 Mon Sep 17 00:00:00 2001 From: hyonun321 Date: Thu, 5 Dec 2024 17:09:58 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20leave/page=20=EB=88=84=EB=9D=BD?= =?UTF-8?q?=EA=B1=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #306 --- client/src/features/workSpace/hooks/usePagesManage.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/features/workSpace/hooks/usePagesManage.ts b/client/src/features/workSpace/hooks/usePagesManage.ts index 9977da5..a26984a 100644 --- a/client/src/features/workSpace/hooks/usePagesManage.ts +++ b/client/src/features/workSpace/hooks/usePagesManage.ts @@ -7,10 +7,10 @@ import { import { Page as CRDTPage } from "@noctaCrdt/Page"; import { WorkSpace } from "@noctaCrdt/WorkSpace"; import { useEffect, useState, useRef, useCallback } from "react"; +import { PAGE, SIDE_BAR } from "@src/constants/size"; import { useSocketStore } from "@src/stores/useSocketStore"; import { useToastStore } from "@src/stores/useToastStore"; import { Page } from "@src/types/page"; -import { PAGE, SIDE_BAR } from "@src/constants/size"; const PAGE_OFFSET = 60; @@ -242,6 +242,11 @@ export const usePagesManage = (workspace: WorkSpace | null, clientId: number | n page.id === pageId ? { ...page, isVisible: false, isLoaded: false } : page, ), ); + // Socket.IO를 통해 서버에 페이지 퇴장 알림 + const socketStore = useSocketStore.getState(); + if (socketStore.socket) { + socketStore.socket.emit("leave/page", { pageId }); + } }; const updatePage = ( pageId: string,