From 27299f7746a69dbc59354cd027069c502cdaddf2 Mon Sep 17 00:00:00 2001 From: Bartosz Sypytkowski Date: Thu, 2 May 2024 08:17:06 +0200 Subject: [PATCH] fix: initialize missing state vector with 0 for new client --- src/utils/encoding.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/encoding.js b/src/utils/encoding.js index 08a9602d..1d84d495 100644 --- a/src/utils/encoding.js +++ b/src/utils/encoding.js @@ -265,7 +265,10 @@ const integrateStructs = (transaction, store, clientsStructRefs) => { */ const updateMissingSv = (client, clock) => { const mclock = missingSV.get(client) - if (mclock == null || mclock > clock) { + if (mclock === undefined) { + // we never seen that client before + missingSV.set(client, 0) + } else if (mclock > clock) { missingSV.set(client, clock) } }