Skip to content

Commit

Permalink
feat: delete/block 및 reorder마다 AllOrderedListIndices 실행 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hyonun321 committed Dec 2, 2024
1 parent d16ebd2 commit 9ae1310
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/src/workspace/workspace.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand All @@ -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,
Expand Down Expand Up @@ -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}`,
Expand Down

0 comments on commit 9ae1310

Please sign in to comment.