This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-19
Channels
- # announcements (3)
- # asami (3)
- # babashka (39)
- # beginners (65)
- # calva (13)
- # cider (4)
- # clj-kondo (69)
- # cljdoc (19)
- # cljs-dev (2)
- # clojure (90)
- # clojure-dev (10)
- # clojure-europe (61)
- # clojure-france (15)
- # clojure-nl (8)
- # clojure-uk (2)
- # clojurescript (28)
- # conjure (2)
- # core-logic (4)
- # cursive (8)
- # datalevin (5)
- # datascript (7)
- # datomic (14)
- # depstar (4)
- # events (1)
- # graphql (7)
- # holy-lambda (5)
- # jobs (5)
- # kaocha (1)
- # malli (14)
- # membrane-term (13)
- # missionary (13)
- # nextjournal (6)
- # off-topic (1)
- # polylith (15)
- # portal (10)
- # re-frame (35)
- # reitit (1)
- # remote-jobs (3)
- # schema (3)
- # sci (121)
- # spacemacs (6)
- # tools-build (8)
- # tools-deps (74)
- # xtdb (7)
Playing with DataScript in the browser, I started having trouble as soon as I tried a build with optimizations. This trivial case reproduces it (node and browser behave the same):
(defn main
[]
(let [conn (ds/create-conn)]
(ds/transact! conn [[:db/add 1 :person/name "Alice"]])
(prn (ds/q '[:find [?e ?v]
:where [?e :person/name ?v]]
@conn))))
> bin/shadow-cljs compile node
[:node] Compiling ...
[:node] Build completed. (65 files, 64 compiled, 0 warnings, 9.90s)
> node build/app.js
[1 "Alice"]
> bin/shadow-cljs release node
[:node] Compiling ...
[:node] Build completed. (65 files, 26 compiled, 0 warnings, 19.27s)
> node build/app.js
[1 #object[Function]]
> bin/shadow-cljs --debug release node
[:node] Compiling ...
[:node] Build completed. (65 files, 26 compiled, 0 warnings, 21.83s)
> node build/app.js
[1 nil]
Am I missing something? (Full source at https://github.com/psagers/datascript-shadow).I’d be interested to know if you find anything out. I’m facing a similar issue but thought that it was because I was storing a File object; it is working with :simple
optimisations but not with :advanced
.
Maybe https://github.com/tonsky/datascript/issues/298 and the related https://github.com/tonsky/datascript/pull/216 could help
That seems to have done it, thanks! ClojureScript/Shadow CLJS have gotten so good at extern inference for interop, it's been a while since I've had to deal with them explicitly.
I took it down since the problem was solved. There was nothing unique or interesting in it. https://github.com/tonsky/datascript/wiki/Tips-&-tricks#externs-and-shadow-cljs