This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-06
Channels
- # announcements (12)
- # babashka (34)
- # beginners (85)
- # calva (76)
- # cider (14)
- # clj-kondo (49)
- # cljs-dev (32)
- # clojure (418)
- # clojure-europe (3)
- # clojure-france (4)
- # clojure-italy (17)
- # clojure-losangeles (8)
- # clojure-nl (5)
- # clojure-norway (2)
- # clojure-spec (2)
- # clojure-uk (88)
- # clojuredesign-podcast (4)
- # clojurescript (49)
- # clojurex (75)
- # clr (2)
- # core-async (13)
- # cursive (6)
- # datomic (57)
- # duct (31)
- # emacs (6)
- # fulcro (25)
- # graalvm (67)
- # graphql (13)
- # hoplon (1)
- # java (6)
- # juxt (11)
- # kaocha (5)
- # keechma (2)
- # leiningen (16)
- # mount (1)
- # off-topic (19)
- # pathom (2)
- # pedestal (1)
- # re-frame (11)
- # reagent (21)
- # reitit (22)
- # rewrite-clj (1)
- # shadow-cljs (98)
- # spacemacs (5)
- # sql (16)
- # tools-deps (8)
- # vim (28)
- # xtdb (4)
while using the jack-in functionality on calva, I noticed an inconsistency related to shadow-cljs start
If I use shadow-cljs start
followed by jacking in, nrepl and server information is never shown
$ yarn shadow-cljs start
yarn run v1.17.3
$ D:\work\learn-re-frame-course-files\cheffy\node_modules\.bin\shadow-cljs start
shadow-cljs - config: D:\work\learn-re-frame-course-files\cheffy\shadow-cljs.edn cli version: 2.8.69 node: v10.16.0
shadow-cljs - server starting ..................................... ready!
Done in 10.14s.
> Executing task: C:\Program Files\nodejs\npx.cmd shadow-cljs -d cider/piggieback:0.4.1 -d cider/cider-nrepl:0.22.4 watch :app <
shadow-cljs - config: d:\work\learn-re-frame-course-files\cheffy\shadow-cljs.edn cli version: 2.8.69 node: v10.16.0
shadow-cljs - connected to server
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build completed. (691 files, 690 compiled, 0 warnings, 46.46s)
this stands in contrast with not using shadow-cljs start
at all, which shows full server information
> Executing task: C:\Program Files\nodejs\npx.cmd shadow-cljs -d cider/piggieback:0.4.1 -d cider/cider-nrepl:0.22.4 watch :app <
shadow-cljs - config: d:\work\learn-re-frame-course-files\cheffy\shadow-cljs.edn cli version: 2.8.69 node: v10.16.0
shadow-cljs - updating dependencies
shadow-cljs - dependencies updated
shadow-cljs - HTTP server available at
shadow-cljs - server version: 2.8.69 running at
shadow-cljs - nREPL server started on port 3333
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build completed. (691 files, 1 compiled, 0 warnings, 9.60s)
Please file an issue specifically about this on Calva. I might be able to figure something out…
@filipematossilva start
runs the server in the background and exits. the output is still logged but to a logfile in the .shadow-cljs
dir
I didn't know about the .shadow-cljs/server.stdout.log
(and .stderr.log
) files
indeed it is there
now I think this is the cause: > Since the nrepl.port file is also created on server startup and Calva looks for files created in .shadow-cljs, I suppose it will never see the file being created and just wait for that.
maybe I can configure one of the regexes in the config sequence to make this work? https://github.com/BetterThanTomorrow/calva/blob/3756a88995ede225c1f84e4ebcec6b685e5f3125/src/nrepl/connectSequence.ts#L143-L154
how this is kinda intended to work is that a server is either started or already running
I'm not sure what those regex are actually used for, but I imagine they parse the output of invoking the watch command
because jack-in also runs that automatically
It’s a long story. But anyway, I think we can figure something out. Thanks for filing the issue!
I wondered if anyone got this error lately: I am using ^:dev-reload
with shadow-cljs, so far so good, but I randomly get the following error whenever I update my app. (It happens with material-ui, so not sure it is something on reagent/shadow-cljs or material-ui)
component.cljs:338 Uncaught TypeError: Cannot read property 'call' of undefined
at new transparency.components.drawer.drawer_react (component.cljs:338)
at constructClassInstance (react-dom.development.js:14240)
at updateClassComponent (react-dom.development.js:18351)
at beginWork$1 (react-dom.development.js:20109)
at HTMLUnknownElement.callCallback (react-dom.development.js:363)
at Object.invokeGuardedCallbackImpl (react-dom.development.js:412)
at invokeGuardedCallback (react-dom.development.js:467)
at beginWork$$1 (react-dom.development.js:25731)
at performUnitOfWork (react-dom.development.js:24639)
at workLoopSync (react-dom.development.js:24615)
transparency.components.app_bar.app_bar_react @ component.cljs:338
constructClassInstance @ react-dom.development.js:14240
updateClassComponent @ react-dom.development.js:18351
beginWork$1 @ react-dom.development.js:20109
callCallback @ react-dom.development.js:363
invokeGuardedCallbackImpl @ react-dom.development.js:412
invokeGuardedCallback @ react-dom.development.js:467
beginWork$$1 @ react-dom.development.js:25731
performUnitOfWork @ react-dom.development.js:24639
workLoopSync @ react-dom.development.js:24615
performSyncWorkOnRoot @ react-dom.development.js:24183
eval @ react-dom.development.js:12239
exports.unstable_runWithPriority @ scheduler.development.js:816
runWithPriority$2 @ react-dom.development.js:12189
flushSyncCallbackQueueImpl @ react-dom.development.js:12234
flushSyncCallbackQueue @ react-dom.development.js:12222
scheduleWork @ react-dom.development.js:23602
updateContainerAtExpirationTime @ react-dom.development.js:26946
updateContainer @ react-dom.development.js:27076
legacyRenderSubtreeIntoContainer @ react-dom.development.js:27680
render @ react-dom.development.js:27757
reagent$dom$render_comp @ dom.cljs:19
eval @ dom.cljs:43
eval @ dom.cljs:38
eval @ core.cljs:77
transparency$core$mount_app @ core.cljs:21
eval @ VM47974:1
shadow$cljs$devtools$client$browser$global_eval @ browser.cljs:233
eval @ browser.cljs:236
shadow$cljs$devtools$client$env$repl_call @ env.cljs:106
shadow$cljs$devtools$client$browser$repl_invoke @ browser.cljs:236
shadow$cljs$devtools$client$browser$handle_message @ browser.cljs:288
eval @ env.cljs:185
shadow$cljs$devtools$client$env$process_next_BANG_ @ env.cljs:173
shadow$cljs$devtools$client$env$process_ws_msg @ env.cljs:186
eval @ browser.cljs:368
component.cljs:338 Uncaught TypeError: Cannot read property 'call' of undefined
at new transparency.components.drawer.drawer_react (component.cljs:338)
The faulty code is this one: in reagent.impl.component
(defn create-class
"Creates JS class based on provided Clojure map.
Map keys should use `React.Component` method names (),
and can be provided in snake-case or camelCase.
Constructor function is defined using key `:getInitialState`.
React built-in static methods or properties are automatically defined as statics."
[body]
{:pre [(map? body)]}
(let [body (cljsify body)
methods (map-to-js (apply dissoc body :displayName :getInitialState :constructor
:render :reagentRender
built-in-static-method-names))
static-methods (map-to-js (select-keys body built-in-static-method-names))
display-name (:displayName body)
get-initial-state (:getInitialState body)
construct (:constructor body)
cmp (fn [props context updater]
(this-as this
(.call react/Component this props context updater) <<<<------------------------ THIS LINE
(when construct
(construct this props))
(when get-initial-state
(set! (.-state this) (get-initial-state this)))
this))]
So react/Component would be nil?
in reagent?
I am using the npm version of react.
So, I should just go inside reagent and change the requirement [react :as react]
as ["react" :as react]
Because the call from the undefined comes from reagent
at new transparency.components.drawer.drawer_react (component.cljs:338)
is called from reagent
component.cljs:338 is a reagent namespace
reagent.impl.component.cljs
this is not a part of react/reagent.
but, whenever I ask chrome to debug on exception, it shows me reagent.impl.component namespace
(defn drawer-react
"The main components of the drawer. Refactor this tab to provides the tabs as
argument."
[{:keys [classes tabsPublic]}]
(let [tabs-public tabsPublic
tabs [[tabs-public (or @(subscribe [::drawer-displayed-sublists]) #{})]]]
[:> mui-drawer
{:open true
:variant :persistent
:class (cs (.-drawerPaper classes))
:ModalProps #js {:onBackdropClick #(dispatch [:close-drawer])}
:PaperProps #js {:class (cs (gobj/get classes "drawerPaperPaperProps"))}}
[:div {:style {:width drawer-width}}
[:div {:class (.-toolbarIcon classes)}
[:> mui-icon-button {:onClick #(dispatch [:toggle-drawer])}
[:> ic-chevron-left {:style {:color "white"}}]]]
[list-divider classes]
[:> mui-list {:style {:padding-top 0}}
(into [:div] tabs)]]]))
haha xD
not at all
not defined though
when I write it in the repl
what is weird, is that it only appears wheneever I reload the code
maybe it is in the "updater" because it is undefined
yes as well
that is defined
hum... I don't know. I might try to dig a bit deeper, maybe this is the answer. My issue is the bug is random
only at reload
I rely on ^dev:after-load to reload the app
(defn ^:dev/after-load start []
(rf/clear-subscription-cache!)
(mount-app))
maybe I should not clear subscription cache xD
I should clear?
or should not?
ok, I will try to come back when I can pinpoint the issue. But it is an annoying bug as it completely mess up with hot reloading.
shadow$cljs$devtools$client$env$repl_call @ env.cljs:106
shadow$cljs$devtools$client$browser$repl_invoke @ browser.cljs:236
shadow$cljs$devtools$client$browser$handle_message @ browser.cljs:288
Hum... Ok I will try to see. I am trying to use your new inspect feature as well
if that can help
I am using emacs
with shadow-cljs
and cider
I execute shadow-cljs watch app
and connect with cider-connect-cljs
Got call, maybe this is the reason. I will check.
Did anyone got ReferenceError: $jscomp is not defined
with google closure compiler?
I got it, just had to output es6 in the clojure compiler
Trying to create a prod deployment from shadow-cljs + compojure project: starting from a completely blank skeleton via lein new re-frame foo +10x +re-frisk +handler
and then run a lein with-profile prod uberjar
I get this error:
[:app] Build completed. (95 files, 46 compiled, 0 warnings, 29.20s)
Warning: The Main-Class specified does not exist within the jar. It may not be executable as expected. A gen-class directive may be missing in the namespace which contains the main method, or the namespace has not been AOT-compiled.
any ideas?kept the :uberjar
target in project.clj
as is, i.e.:
:uberjar {:source-paths ["env/prod/clj"]
:dependencies [[day8.re-frame/tracing-stubs "0.5.3"]]
:omit-source true
:main foo.server
:aot [foo.server]
:uberjar-name "foo.jar"
:prep-tasks ["compile" ["prod"]]}
@web20 do you have (defn -main [] ...) in foo.server, and (:gen-class) in it's namespace decleration?
this isn't a shadow-cljs problem, but looking at the source path, are you sure that ./env/prod/clj/foo/server.clj exists at this location?
@hlolli ha! no that's empty.. I assume lein prod
would populate that path? even if I run lein prod
(which runs -m shadow.cljs.devtools.cli release app
), then env/prod/clj
remains empty.
I would segment the the dubug process. 1. make sure that shadow-cljs is producing .js files from .cljs sources. And then, debug the server. Source paths here in this case are left untouced, only your target directory and uberjar are written during compilation.