datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
2019-11-20T03:35:21.057400Z

As far as I can tell that should work. I would be interested in seeing whether breaking that into two transactions works. But this should work in Datomic and I would expect it to in DataScript. I'd GH issue.

Oliver George 2019-11-20T08:37:11.058500Z

Yeah, I'm thinking it's some new VM optimisation breaking protocols. Behold the insanity...

datascript.db/maybe-wrap-multival.b not a collection at all, so definitely a single value {vs [{:sighting/id 123}], (type vs) #object[_i], (arrays/array? vs) false, (coll? vs) false, (map? vs) false}

Oliver George 2019-11-20T08:37:39.059100Z

That debugging statement confirms that vs which is a vector is not a coll?!

Oliver George 2019-11-20T08:38:56.060Z

I'd had fleeting glimpses of some odd behaviour with clj->js recently which I'm starting to suspect is related to the same issue.

Oliver George 2019-11-20T08:51:08.060400Z

Here's some sample code and logged output. Note that vs is a vector, (coll? vs) is false but (satisfies? ICollection vs) is true! https://gist.github.com/olivergeorge/f4251884d74f32bba2025ebc48b626ef

Oliver George 2019-11-20T08:52:23.061400Z

Only observed using the release config on iOS simulator so I guess some VM optimisation is causing an issue.

Oliver George 2019-12-05T12:30:00.066500Z

Late follow up on this. Problem was not with datascript.

souenzzo 2019-11-20T11:27:37.063300Z

[{:sighting/id 123}] isnt a collection of lookup It should be [[:sighting/id 123]] @olivergeorge