From b657a5724591d4f1c3eed56848dfa444a91c3f5f Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Thu, 5 Sep 2024 09:54:42 +0200 Subject: [PATCH] index updates have to be aligned --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 5a110aa..b326429 100644 --- a/index.js +++ b/index.js @@ -107,12 +107,12 @@ class HyperDB { const idx = collection.indexes[i] const prevKey = prevDoc && idx.encodeKey(prevDoc) const nextKey = idx.encodeKey(doc) - - if (prevKey !== null && b4a.equals(nextKey, prevKey)) continue - const ups = [] + u.indexes.push(ups) + if (prevKey !== null && b4a.equals(nextKey, prevKey)) continue + if (prevKey !== null) ups.push({ key: prevKey, del: true }) if (nextKey !== null) ups.push({ key: nextKey, del: false }) }