From a27c86083acc24759b81bb01930c951d59b1beec Mon Sep 17 00:00:00 2001 From: Judith Massa <52293389+jsmassa@users.noreply.github.com> Date: Tue, 26 Apr 2022 17:22:46 +0200 Subject: [PATCH] Fix retraction for persistent set index (#521) * Fix retraction for persistent set index * Add changelog entry --- CHANGELOG.md | 1 + src/datahike/db.cljc | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92833e6f2..cc645fc93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - Fix tx-meta on transact through api-ns - Improve code samples using transact with arg-map @podgorniy - Insert into persistent sorted set does not replace existing datom with identical EAV +- Single datom retraction fixed for persistent set index ## 0.4.0 diff --git a/src/datahike/db.cljc b/src/datahike/db.cljc index aea9fae26..e2637be84 100644 --- a/src/datahike/db.cljc +++ b/src/datahike/db.cljc @@ -2043,8 +2043,9 @@ [e a] (let [v (if (ref? db a) (entid-strict db v) v)] (validate-val v entity db) - [e a v]))] - (recur (reduce transact-retract-datom report (-search db pattern)) entities)) + [e a v])) + datoms (vec (-search db pattern))] + (recur (reduce transact-retract-datom report datoms) entities)) (recur report entities)) (= op :db.fn/retractAttribute)