Fork me on GitHub
#datascript
<
2024-03-01
>
magra12:03:41

(d/q '[:find [(pull ?e ?pattern) ...]
        :in $ ?sf ?pattern includes?
        :where
        [?e :person/firstname ?f]
        [(includes? ?f ?sf)]
        [?e :person/id ?i]]
      db search-firstname pattern includes?)
includes? is a function. This works in development, but returns []in production compiled with shadow-cljs in a webworker. What do I have to do to the function so it works in advanced compilation?

magra13:03:15

This works:

(d/q `[:find [(~'pull ~'?e ~'?pattern) ...]
       :in ~'$ ~'?sf ~'?pattern
       :where
       [~'?e :person/firstname ~'?f]
       [(~includes? ~'?f ~'?sf)]
       [~'?e :person/id ~'?i]]
     db search-firstname pattern)

magra15:03:39

:compiler-options {:externs ["datascript/externs.js"]} did it.