datascript 2025-03-13

I am experiencing a very strange problem I can't explain, my query is failing to find the entity in the database.

(defn fetch-plant-eid-from-uuid [uuid]
  (prn (str "fetch plant from uuid " uuid))
  (prn @diag)
  (prn (d/q '{:find [?plant]
               :in [$ ?uuid]
               :where [[?plant :plant/id ?uuid]]} @diag "b0247752-5eab-4987-8116-78d43dcf9b04"))

  (prn (d/q '{:find [?plant]
               :where [[?plant :plant/id "b0247752-5eab-4987-8116-78d43dcf9b04"]]} @diag )))
If you look at the first query which passes in the uuid as a string it fails to find the entity, the second query which has the uuid in-lined inside the query does work, which see very strange to me anyone got any pointers on what might be going on (edited)

should be identical

If you can make a reproduceable test case feel free to open an issue

That was my thinking which is why I am a bit confused, I have other queries I am running which are working fine, I have also noticed it seems to work locally it only after deployment with shadow cljs so I guess it could be related to the optimizations in some way, I will carry on digging I imagine replicating it will be quite difficult. probably I will just change to inlining the value if I don't get any where

Do you provide externs to shadow?

That has been a source of so many bugs

Thanks @tonsky For the suggestion I have this :compiler-options {:infer-externs :auto :output-feature-set :es6} which I thought should be sufficient or should I be more explicit ?

I added in the externs and that seems to have resolved it so you where correct in that assumption thanks again πŸ™‚

πŸ‘ 1

Glad it helped. I tried to convince them shadow should respect externs that come with a library but they don’t want to listen