This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-07
Channels
- # aleph (4)
- # arachne (2)
- # aws (2)
- # beginners (42)
- # boot (4)
- # cider (47)
- # cljs-dev (352)
- # clojure (278)
- # clojure-dusseldorf (6)
- # clojure-italy (6)
- # clojure-russia (1)
- # clojure-spec (15)
- # clojure-uk (94)
- # clojurescript (197)
- # community-development (34)
- # cursive (3)
- # data-science (1)
- # datomic (64)
- # emacs (3)
- # figwheel (16)
- # fulcro (7)
- # hoplon (5)
- # jobs (3)
- # luminus (3)
- # mount (2)
- # nyc (1)
- # off-topic (31)
- # onyx (22)
- # parinfer (1)
- # protorepl (7)
- # re-frame (9)
- # reagent (61)
- # ring-swagger (3)
- # shadow-cljs (149)
- # spacemacs (18)
- # specter (4)
- # timbre (1)
- # unrepl (38)
- # vim (17)
- # yada (14)
Running 2.2.4
, I’m seeing #shadow-hud-loading-container
but not seeing #shadow-hud-container
if I force a syntax error (just an error in the terminal). Was the HUD changed in some recent version? (I upgraded from a 2.0.x
version)
@pithyless didn't change the HUD in a while no (and its working as usual for me)
random cljs repl question. Quite frequently for whatever reason I get a “REPL Timed out” error (maybe caused by a syntax error or something else). Is there something I should try other than restarting the whole shadow-cljs server to get it working again? refreshing the browser page usually doesn’t work, nor does re-opening a new nrepl connection
I recently added (shadow.cljs.devtools.api/reload!)
to "restart" the server without restarting the JVM
right now i am already in that state, and I am trying to evaluate :cljs/quit, i see
Error evaluating - class java.lang.InterruptedException:
Error evaluating - class java.util.concurrent.RejectedExecutionException: Task [email protected] rejected from [email protected][Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 4]
yeah I think while we were chatting I had already started going through the motions of restarting the thing and forgot
so, if I get the timed out error, I should try to :cljs/quit
and then (shadow.cljs.devtools.api/reload!)
is there a flag to make the development server log requests, perhaps in one of the common log formats?
debugging. sometimes static resources load funny, or i have some kind bug with the way i’m manipulating client-side html5 history. it is nice to know sometimes when my app is actually hitting the server and what it is requesting
i can’t figure out why i am apparently loading an image successfully but i get a broken link image
are you sure the image is getting loaded? I mean with push state you get success for everything although it always the index.html
the other issue i have is when i’m not at the root level and I manually refresh, the development server doesn’t reserve the app like i would expect
I guess I just wanted to sanity check what the hell was going on by checking the server logs. But you are right, there are other ways to debug this.
use /js/main.js
. otherwise it will attempt to load something/js/main.js
when you are in /something/path
create-react-app handles this problem really well. i think they look at the headers. they also have a very convenient proxying feature so that development and deployment look similar when you server the bundle from the api server: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#proxying-api-requests-in-development
because I think its the right way to get an opinionated set of tools going and get people interested in cljs development
should I just make the push-state thingo the default? kinda feels like it might be the "usual" thing you want for a cljs app
you just get so much functioning stuff for free with create-react-app. just look at the user manual.
in my experience, people overestimate the value of customization and underestimate the cognitive load needed to make decisions
even though I am a big fan of shadow-cljs and tell everyone to use it on slack, there is still something totally amazing about create-react-app. you npm install it, you create a new project, you say npm start
, and BAM, you have a working hot reloading project. you can start editing right then and there. shadow is great, but you still have to go read the section on :devtools
, pick a directory, make sure you’re setting it right, figure out how the :after-load
handler works and install it somewhere, etc. etc. each of these things = friction.
if you want to do a little experiment in react, it’s super easy because you can just fire off a c-r-a, do some stuff on the main page, and then throw it away
also, shadow can’t really be opinionated about reagent vs. rum or what have you, whereas a create-reagent-app could
I'm all for making things easier especially for beginners but I do think that some config is important
I could certainly simplify the :browser
target and introduce some convention around it
from that is infers my.app/start
and my.app/stop
as the :after-load
and optional :before-load
zero config should be thought of more like “sensible defaults for generic things that most people will want”
even with c-r-a you can eject. the only reason they did it that way is that it allows them to update the toolchain from underneath you, which is totally rad.
and i think you’ve largely succeeded. the thing is that c-r-a does that one level up on the stack. it picks react, a testing framework, a bundler, give some options for addons like less/sass, etc.
one thing that create-react-app
did which is quite clever is that they separated out create-react-app
, which is a generic tool, from react-scripts
i wonder if shadow-cljs
might be able to act as create-react-app
and then you could write the react-scripts
equivalent for, say, reagent.
some people just fork react-scripts if they want quasi configuration capabilities. and others have react-scripts variants available
just most of the template is hidden in react-scripts
rather than the template itself
this is a big reason why i think lein ended up hurting the community. people made stuff that is complicated and undocumented but hid it behind a lein template
{:source-paths
["src"]
:dependencies
[[reagent/shadow-cljs "1.0.0"]]
:builds
{:app {:target :reagent
:app-ns my.app}}}
so what would that script refer to? like, would it know to download something and then run it?
i’m confused. i don’t see any documentation on a :reagent
target in the guide. are you saying one can create custom targets?
not well documented but you can just delegate to the :browser
target for everything in this case
basically just generate the usual :browser
config from that :target :reagent
baseline and call the browser/process
fn
bascially what :reagent
means is that shadow-cljs will try to load shadow.build.targets.reagent/process
this is great! i never really grokked this but shadow-cljs does really emulate c-r-a in structure
I might need to make a few adjustments to the devtools http stuff. this is not as flexible as I'd like it to be.
@hlolli already created a basic chrome extension template this way. https://gist.github.com/hlolli/265b9183566a4c5829d7ee355e3d0998
which is basically just :browser
with one adjustment to only output a single file in development
{:source-paths
["src"]
:dependencies
[[reagent/shadow-cljs "1.0.0"]]
:builds
{:app {:target :reagent
:app-ns my.app}}}
also it would make you a gatekeeper of sorts. much better this way so people can just do whatever
i have read of companies forking react-scripts privately so that they can keep their configuration separate and shared internally among their own projects
a more focused :target
could definitely set way more aggressive defaults than :browser
can. and since its just clojure data you could just generate the more complex :browser
config from the "easy" one.
@lee.justin.m just pushed 2.2.5
which makes push-state the default and does the Accept
header check to no longer serve images as html