From ad9817974bc573116fd1bf6a40be163bd5e1a35a Mon Sep 17 00:00:00 2001 From: streamich Date: Mon, 29 Jul 2024 12:56:43 +0200 Subject: [PATCH] =?UTF-8?q?feat(json-crdt-patch):=20=F0=9F=8E=B8=20allow?= =?UTF-8?q?=20readin=20patches=20sequentially?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/json-crdt-patch/codec/binary/Decoder.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/json-crdt-patch/codec/binary/Decoder.ts b/src/json-crdt-patch/codec/binary/Decoder.ts index e45b892e0b..ed0e00edd5 100644 --- a/src/json-crdt-patch/codec/binary/Decoder.ts +++ b/src/json-crdt-patch/codec/binary/Decoder.ts @@ -29,8 +29,12 @@ export class Decoder extends CborDecoder { * @returns A JSON CRDT patch. */ public decode(data: Uint8Array): Patch { + this.reader.reset(data); + return this.readPatch(); + } + + public readPatch(): Patch { const reader = this.reader; - reader.reset(data); const sid = reader.vu57(); const time = reader.vu57(); const isServerClock = sid === SESSION.SERVER;