We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cd9d12f commit 5e33440Copy full SHA for 5e33440
src/datascript/storage.cljs
@@ -158,9 +158,11 @@
158
:max-eid max-eid
159
:max-tx max-tx})]
160
(remember-db db)
161
- [db (mapv #(keep (fn [[e a v tx]]
162
- (when (nil? (db/-datoms db :eavt e a v nil))
163
- (db/datom e a v tx))) %)
+ [db (mapv #(keep (fn [[e a v tx added]]
+ ;; fix unique constraint
+ (let [datom-exists? (some? (db/-datoms db :eavt e a v nil))]
164
+ (when-not (and datom-exists? added)
165
+ (db/datom e a v tx added)))) %)
166
tail)]))))
167
168
(defn db-with-tail [db tail]
0 commit comments