From 9ae13103fd4f2fab4b70a9c9be4441cee74b617b Mon Sep 17 00:00:00 2001 From: hyonun321 Date: Tue, 3 Dec 2024 01:27:06 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20delete/block=20=EB=B0=8F=20reorder?= =?UTF-8?q?=EB=A7=88=EB=8B=A4=20AllOrderedListIndices=20=EC=8B=A4=ED=96=89?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #276 --- server/src/workspace/workspace.gateway.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/src/workspace/workspace.gateway.ts b/server/src/workspace/workspace.gateway.ts index 541e27b..cb3e94b 100644 --- a/server/src/workspace/workspace.gateway.ts +++ b/server/src/workspace/workspace.gateway.ts @@ -632,6 +632,7 @@ export class WorkspaceGateway implements OnGatewayInit, OnGatewayConnection, OnG pageId: data.pageId, } as RemoteBlockDeleteOperation; this.emitOperation(client.id, data.pageId, "delete/block", operation, batch); + currentPage.crdt.LinkedList.updateAllOrderedListIndices(); } catch (error) { this.logger.error( `Block Delete 연산 처리 중 오류 발생 - Client ID: ${clientInfo?.clientId}`, @@ -656,14 +657,14 @@ export class WorkspaceGateway implements OnGatewayInit, OnGatewayConnection, OnG `Block Update 연산 수신 - Client ID: ${clientInfo?.clientId}, Data:`, JSON.stringify(data), ); - + console.log(data); const { workspaceId } = client.data; const currentPage = await this.workSpaceService.getPage(workspaceId, data.pageId); if (!currentPage) { throw new Error(`Page with id ${data.pageId} not found`); } currentPage.crdt.remoteUpdate(data.node, data.pageId); - + currentPage.crdt.LinkedList.updateAllOrderedListIndices(); const operation = { type: "blockUpdate", node: data.node, @@ -710,6 +711,7 @@ export class WorkspaceGateway implements OnGatewayInit, OnGatewayConnection, OnG pageId: data.pageId, } as RemoteBlockReorderOperation; this.emitOperation(client.id, data.pageId, "reorder/block", operation, batch); + currentPage.crdt.LinkedList.updateAllOrderedListIndices(); } catch (error) { this.logger.error( `Block Reorder 연산 처리 중 오류 발생 - Client ID: ${clientInfo?.clientId}`,