From 18ed34df7f38d19eb8a9c2381326a4ebdb60b687 Mon Sep 17 00:00:00 2001 From: Eugene Zaretskiy Date: Wed, 16 Aug 2023 21:55:44 -0400 Subject: [PATCH] onChange should update instead of sync --- packages/extension-redis/src/Redis.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/extension-redis/src/Redis.ts b/packages/extension-redis/src/Redis.ts index 314d2fbef..e9756614e 100644 --- a/packages/extension-redis/src/Redis.ts +++ b/packages/extension-redis/src/Redis.ts @@ -290,7 +290,12 @@ export class Redis implements Extension { * if the ydoc changed, we'll need to inform other Hocuspocus servers about it. */ public async onChange(data: onChangePayload): Promise { - return this.publishFirstSyncStep(data.documentName, data.document) + const { documentName } = data + const updateMessage = new OutgoingMessage(documentName) + .createSyncMessage() + .writeUpdate(data.update) + + return this.pub.publishBuffer(this.pubKey(documentName), Buffer.from(updateMessage.toUint8Array())) } /**