We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6ebfce8 commit b28f657Copy full SHA for b28f657
src/datascript/storage.cljs
@@ -158,7 +158,15 @@
158
:max-eid max-eid
159
:max-tx max-tx})]
160
(remember-db db)
161
- [db (mapv #(mapv (fn [[e a v tx]] (db/datom e a v tx)) %)
+ [db (mapv #(keep (fn [[e a v tx]]
162
+ ;; TODO: do we still need this?
163
+ ;; fix unique constraint
164
+ (let [datoms (db/-datoms db :eavt e a v nil)
165
+ datom-exists? (some (fn [datom] (= tx (:tx datom))) datoms)
166
+ ;; retracted tx < 0
167
+ added? (> tx 0)]
168
+ (when-not (and datom-exists? added?)
169
+ (db/datom e a v tx))))%)
170
tail)]))))
171
172
(defn db-with-tail [db tail]
0 commit comments