This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-13
Channels
- # babashka (1)
- # beginners (11)
- # cider (8)
- # clj-kondo (7)
- # clojure (35)
- # clojure-italy (2)
- # clojurescript (6)
- # conjure (5)
- # datomic (10)
- # duct (7)
- # fulcro (9)
- # helix (2)
- # introduce-yourself (5)
- # lsp (3)
- # malli (7)
- # meander (3)
- # off-topic (8)
- # pathom (3)
- # podcasts-discuss (2)
- # portal (9)
- # reitit (7)
- # releases (3)
- # shadow-cljs (43)
- # sql (25)
- # tools-deps (3)
Codox seems to be barfing on the :default
in :require
that shadow-cljs enables. Does anyone know a way to tell codox to allow it? The error is:
Caused by: clojure.lang.ExceptionInfo: Only :as, :refer and :rename options supported in :require / :require-macros; offending spec: ["react-bootstrap-table2-editor" :default cellEditFactory] at line 1 file:/Users/rberger/omnyway/neo/lib/re-view/src/review/table.cljs {:file #object[java.net.URL 0x1835b24b "file:/Users/rberger/omnyway/neo/lib/re-view/src/review/table.cljs"], :line 1, :column 1, :tag :cljs/analysis-error}
Or is my only painful alternative is to replace the very nice :default
with :as and an alias?@rberger you can use the new official alternative ["react-bootstrap-table2-editor$default" :as cellEditFactory]
, see https://clojurescript.org/news/2021-04-06-release#_library_property_namespaces
If I use the new official alternative, do I use the alias in the code just like it was the previous :default
? I.e (cellEditFactory (clj->js {:mode "click"}))
(without the /default
)
FWIW don't do this (cellEditFactory (clj->js {:mode "click"}))
. for really simple JS objects like that just use #js
eg. (cellEditFactory #js {:mode "click"})
I'm getting bunch of infer-warnings on shadow-cljs with Reagent (the project itself, not when using as library). Seems to be related to deftype
and extending a protocol without any methods. Though IAtom doesn't cause these problems, any ideas?
(defprotocol IReactiveAtom)
(deftype IRatom [bar]
IAtom
IReactiveAtom
)
------ WARNING #1 - :infer-warning ---------------------------------------------
File: /home/juho/tmp/your-project/src/your_project/core.cljs:30:1
--------------------------------------------------------------------------------
27 |
28 | (defprotocol IReactiveAtom)
29 |
30 | (deftype Ratom [bar]
-------^------------------------------------------------------------------------
Cannot infer target type in expression (. (. IRatom -prototype) -your-project$core$IReactiveAtom$)
--------------------------------------------------------------------------------
31 | IAtom
32 | IReactiveAtom
33 | )
34 |
--------------------------------------------------------------------------------
No, but I guess I need to check if I'm running warn-on-infer there.
if that doesn't warn I can fix it. if not its happening somewhere in the CLJS parts of inference
Strange, I get different warnings with cljs.main:
Compiling /home/juho/Source/reagent/src/reagent/ratom.cljs to target/bundle-adv/resources/public/js/out/reagent/ratom.js
WARNING: Cannot infer target type in expression (. c push derefed) at line 76 /home/juho/Source/reagent/src/reagent/ratom.cljs
WARNING: Cannot infer target type in expression (. G__6105 push p2__6103#) at line 98 /home/juho/Source/reagent/src/reagent/ratom.cljs
WARNING: Cannot infer target type in expression (. G__6105 push p3__6104#) at line 98 /home/juho/Source/reagent/src/reagent/ratom.cljs
WARNING: Cannot infer target type in expression (. v -destroy) at line 328 /home/juho/Source/reagent/src/reagent/ratom.cljs
WARNING: Cannot infer target type in expression (. a push f) at line 495 /home/juho/Source/reagent/src/reagent/ratom.cljs
And shadow-cljs:
------ WARNING #1 - :infer-warning ---------------------------------------------
File: /home/juho/Source/reagent/src/reagent/ratom.cljs:129:1
--------------------------------------------------------------------------------
126 |
127 | (defprotocol IReactiveAtom)
128 |
129 | (deftype RAtom [^:mutable state meta validator ^:mutable watches]
-------^------------------------------------------------------------------------
Cannot infer target type in expression (. (. RAtom -prototype) -reagent$ratom$IReactiveAtom$)
--------------------------------------------------------------------------------
130 | ; IAtom
131 | IReactiveAtom
132 |
133 | IEquiv
--------------------------------------------------------------------------------
------ WARNING #2 - :infer-warning ---------------------------------------------
File: /home/juho/Source/reagent/src/reagent/ratom.cljs:208:1
--------------------------------------------------------------------------------
205 | (set! (.-reaction obj) r))
206 | v))))
207 |
208 | (deftype Track [f args ^:mutable reaction]
-------^------------------------------------------------------------------------
Cannot infer target type in expression (. (. Track -prototype) -reagent$ratom$IReactiveAtom$)
--------------------------------------------------------------------------------
209 | IReactiveAtom
210 |
211 | IDeref
212 | (-deref [this]
--------------------------------------------------------------------------------
------ WARNING #3 - :infer-warning ---------------------------------------------
File: /home/juho/Source/reagent/src/reagent/ratom.cljs:250:1
--------------------------------------------------------------------------------
247 |
248 | ;;; cursor
249 |
250 | (deftype RCursor [ratom path ^:mutable reaction
-------^------------------------------------------------------------------------
Cannot infer target type in expression (. (. RCursor -prototype) -reagent$ratom$IReactiveAtom$)
--------------------------------------------------------------------------------
251 | ^:mutable state ^:mutable watches]
252 | IAtom
253 | IReactiveAtom
254 |
--------------------------------------------------------------------------------
------ WARNING #4 - :infer-warning ---------------------------------------------
File: /home/juho/Source/reagent/src/reagent/ratom.cljs:358:1
--------------------------------------------------------------------------------
355 | ;; - state
356 | ;; - watches
357 | ;; - watching
358 | (deftype Reaction [f ^:mutable state ^:mutable ^boolean dirty? ^boolean nocache?
-------^------------------------------------------------------------------------
Cannot infer target type in expression (. (. Reaction -prototype) -reagent$ratom$IReactiveAtom$)
--------------------------------------------------------------------------------
359 | ^:mutable watching ^:mutable watches ^:mutable auto-run
360 | ^:mutable caught]
361 | IAtom
362 | IReactiveAtom
--------------------------------------------------------------------------------
Minimal project https://github.com/Deraen/shadow-cljs-infern-warning, npm run release
shows the warning, build.sh
doesn't
fixed in https://github.com/thheller/shadow-cljs/commit/721f71dce7ca55bf9b3c5d80b38709e68270ef4a, released in 2.14.5
hello, i’ve a quick question. I’m trying to create a devcards macro that basically just wraps components with my react lib’s theme provider, and realized it presents a bit of a catch 22 as i need the symbol for the react component in the actual clj implementation. i know the general approach is to make sure you use fully qualified symbols (clojure.core/xxx). But since the ["mylib" :default/refer …]
syntax is cljs/shadow specific, just wondering what (if any) equivalent there is.
create a helper function that does what you need. (defn foo-helper [a b] (that-npm-alias/do-stuff a b))
. maybe even helps reducing the amount of code the macro generates.
you can also use cljs.analyzer/resolve-var
to get the actual alias if helper function is not an option
a helper on the clj side? I tried something like that w/o creating the macro, for something like (defcard xxx (wrap-theme comp))
but I think the arg capture confuses things.
for the helper i tried a couple things someting like:
(defn theme
[x]
[:> ThemeProvider
x])
as well as another variant that returned an fnbut i hadn’t gotten far on the macro, as I realized i wasn’t sure how to fully qualify ThemeProvider
yeah i didn’t think so, but for whatever reason it doesn’t seem to work. will try checking the macro expansion
Hi,
I keep getting shadow-cljs - Stale Output! Your loaded JS was not produced by the running shadow-cljs instance. Is the watch for this build running
message when trying from Emacs cider-jackin-cljs
What option do I miss?
My .dir-locals.el
looks like
((nil . ((cider-preferred-build-tool . shadow-cljs)
(cider-default-cljs-repl . shadow)
(cider-shadow-default-options . "app")
(cider-shadow-watched-builds . ("app")))))
I am trying out the example project here https://github.com/shadow-cljs/quickstart-browser
either you are loading the wrong javascript (often happens when people rename :modules
or change :output-dir
)
or you might have 2 instances of shadow-cljs running competing with each other and conflicting
note that jack-in from emacs starts a new fresh instance, so if you have shadow-cljs watch
already running separately that would be your conflict
I am sure I don’t have anything running as I list all of my open program and then kill off all node process just to make sure and I am still getting the error.