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 e20436a commit c536d5aCopy full SHA for c536d5a
src/datascript/db.cljc
@@ -1766,7 +1766,7 @@
1766
(util/cond+
1767
(= op :db.fn/call)
1768
(let [[_ f & args] entity]
1769
- (recur report (concat (apply f db args) entities)))
+ (recur report (concat (assoc-auto-tempids db (apply f db args)) entities)))
1770
1771
(and (keyword? op)
1772
(not (builtin-fn? op)))
test/datascript/test/transact.cljc
@@ -474,3 +474,10 @@
474
(is (empty? (->> (d/datoms db :eavt)
475
(map (fn [[_ a v]] [a v]))
476
(remove #(d/entity db %)))))))
477
+
478
+(deftest test-db-fn-returning-entity-without-db-id-issue-474
479
+ (let [conn (d/create-conn {})
480
+ _ (d/transact! conn [[:db.fn/call (fn [db]
481
+ [{:foo "bar"}])]])
482
+ db @conn]
483
+ (is (= #{[1 :foo "bar"]} (tdc/all-datoms db)))))
0 commit comments