Fix upserts containing tempids in tuples
PR to address #378. Not sure how dirty the implementation is for this ... but tests pass so 🤷
Cheers.
Thank you for the bug report and the PR. This is an interesting problem :)
I feel that tempid resolution should not happen in resolve-upserts, but somewhere earlier, around
https://github.com/tonsky/datascript/blob/1f060c07dfad2a700a8be702802734266dcf0222/src/datascript/db.cljc#L1431-L1439
Basically, same code should run, but for all tuple values, not just for a single v.
Also, checking for being a tuple is better not by coll?, but by going to schema
https://github.com/tonsky/datascript/blob/1f060c07dfad2a700a8be702802734266dcf0222/src/datascript/db.cljc#L900-L902
I've updated the test case - the entity to upsert now comes first which breaks the approach I was taking with this.