This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-04
Channels
- # announcements (5)
- # beginners (124)
- # boot (43)
- # braveandtrue (8)
- # calva (1)
- # cider (44)
- # cljs-dev (1)
- # clojure (188)
- # clojure-canada (3)
- # clojure-germany (1)
- # clojure-italy (5)
- # clojure-nl (13)
- # clojure-russia (1)
- # clojure-spec (14)
- # clojure-uk (42)
- # clojurescript (94)
- # core-async (5)
- # cursive (5)
- # datomic (45)
- # duct (3)
- # emacs (6)
- # figwheel-main (93)
- # fulcro (22)
- # graphql (3)
- # hyperfiddle (1)
- # leiningen (3)
- # off-topic (1)
- # pedestal (1)
- # play-clj (1)
- # portkey (1)
- # re-frame (17)
- # reagent (71)
- # remote-jobs (2)
- # rum (3)
- # shadow-cljs (45)
- # spacemacs (17)
- # specter (18)
- # tools-deps (27)
- # unrepl (1)
- # vim (3)
i was asking about some visualization of how figwheel/repls work. i just noticed amongst my tweets a retweet of this: https://www.reddit.com/r/Clojure/comments/6kht1e/diagramming_the_flow_of_figwheel/ (the link in the article is broken. have to change http://planttext.com to http://plantuml.com in the diagram's url)
yes I should probably take that diagram as inspiration for creating a more accurate one for figwheel-main
just came across this and it seems nice: https://timothypratley.blogspot.com/2015/07/you-should-be-using-figwheelreagent.html
It's a tetris tutorial using figwheel and reagent
@bhauman can confirm that ns auto-detection works now
also the target
directory fix 💥
I'd like to be able to use the same cljs-spa.test-runner ns for cljs-test-display and from the CLI
Here's what I came up with: https://github.com/pesterhazy/cljs-spa-example/blob/64dcf126e6904f27d8e87d10fa788dbc81d63180/test/cljs_spa/test_runner.cljs#L19-L21 - a little hacky but it works
Am I right in assuming that to trigger something in the Extra Main page you need to run code at NS init time?
Oh, and I tried :auto-testing
- it works great! Is it planned to support auto-testing from the command line as well?
@pesterhazy thanks for confirming all of this, I’m going to look at out your PR sometime today.
but because of the nature of extra-mains its probably better to just put it at the top level
I’m glad you like auto-testing, I think it should obviate the need for a test-runner that does both.
It hadn’t occurred to me to do autotesting from the command line. You could just change the :open-url
to the testing endpoint and that would do it.
and the test runner is a source of merge conflicts all the time. really glad to see this focus
hmmm I’m going to have to put more thought into what it would take to have auto testing from the command line
I'm debugging the weirdest problem with reagent/react with figwheel main
I get a runtime exception, Cannot read property 'render' of undefined
According to the sourcemap, it's in this line https://github.com/reagent-project/reagent/blob/master/src/reagent/dom.cljs#L20
but react-dom is mapped to window.ReactDOM in foreign-libs
and window.ReactDOM.render
most definitely exists (as seen from the devtools console)
I'm using a webpack bundle to provide react-dom
The compiled js looks like this
reagent.dom.node$module$react_dom.render.call()
@bhauman I'm on the edge of my seat
I thought it would be missing :exclusions
but clojure -Stree
is clean (no mention of cljsjs)
whats happening is that the goog.require('react-dom')
is async right before var reagent.dom.node$module$react_dom.render = js/ReactDOM
the preamble looks like this
// Compiled by ClojureScript 1.10.238 {}
goog.provide('reagent.dom');
goog.require('cljs.core');
goog.require('react_dom');
goog.require('reagent.impl.util');
goog.require('reagent.impl.template');
goog.require('reagent.impl.batching');
goog.require('reagent.ratom');
goog.require('reagent.debug');
goog.require('reagent.interop');
reagent.dom.global$module$react_dom = goog.global.ReactDOM;
no, normally in the browser on first load
but the theory rings true to me
so the way the module reference is fixed at ns init time is in conflict with the fact that goog.require is async
thie problem is caused by figwheel taking over the loading process once its been loaded
I didn't even know that goog.require can be async
right, that's what I assumed
in fact, once the code gets to the point where the exception is thrown, react is already loaded
(defn ^:export main []
(js/console.warn "XXX" js/reagent.dom.global$module$react_dom)
(r/render [playground.slide/main-ui] (js/document.getElementById "app")))
that's the code that triggers the exception
but the console.warn prints out that the var is correctly set at that stage
no wait the code that bombs out is actually
reagent.dom.node$module$react_dom.render.call
not that I know of...
I mean hmmm
I had a strange encounter before where the compiler asked me to install
npm install --save '@cljs-oss/module-deps'
well that just looks wrong if reagent.dom.global$module$react_dom = goog.global.ReactDOM;
is at the top of the compiled file
I was confused why module-deps
was necessary - I'm not using npm integration or anything like that
I didn't set that :npm-deps false
manually, because I thought that would be the default
oh wow!
that fixed it
it works now
when I fixed it, I did two things: I removed node_modules and package.json (which as you say aren't require), and I added a manual :npm-deps false
I don't know which of those two fixed things
yes exactly
I'll make a mental note to always explicitly set :npm-deps false
from now on
man, thanks for demystifying this, I thought I was losing my mind
Added it to the example repo as well: https://github.com/pesterhazy/cljs-spa-example/commit/860656777137b258b4c39f49c2d74be9ae75e449