This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-17
Channels
- # beginners (70)
- # boot (4)
- # cider (16)
- # clara (6)
- # cljdoc (21)
- # cljs-dev (2)
- # cljsrn (1)
- # clojure (73)
- # clojure-finland (2)
- # clojure-nl (6)
- # clojure-russia (35)
- # clojure-sg (1)
- # clojure-spec (14)
- # clojure-uk (146)
- # clojurebridge (2)
- # clojurescript (128)
- # cryogen (2)
- # cursive (20)
- # datomic (27)
- # emacs (6)
- # events (8)
- # figwheel-main (57)
- # fulcro (46)
- # hoplon (3)
- # hyperfiddle (2)
- # immutant (3)
- # jobs (6)
- # jobs-discuss (15)
- # juxt (2)
- # off-topic (33)
- # parinfer (2)
- # portkey (4)
- # protorepl (1)
- # re-frame (4)
- # reagent (78)
- # ring-swagger (45)
- # schema (6)
- # shadow-cljs (167)
- # spacemacs (2)
- # specter (13)
- # tools-deps (6)
@bhauman @iam i was just about to ask about the figwheel.main
+ devcards
story too, because i want to implement it in our company too, so it's very likely that i will be an early adopter of this new :extra-main-files
feature.
i didn't know about hawk
, so thanks for mentioning it.
we are usually using http://www.entrproject.org in conjunction with https://github.com/DarthSim/overmind but that's not as programmable as hawk
and i was missing the ability to build pipelines of build steps this way.
at first glance maybe hawk can help to do that...
i have this devcard using dom-node
and it's not updating when the atom is changing:
(defcard my-first-card
(dom-node
(fn [data node]
(let [el (js/document.createElement "h1")]
(doto el
(set! -onclick #(swap! data update :counter inc))
(set! -innerText (-> data deref :counter str)))
(.appendChild node el))))
(atom {:counter 123}))
if figwheel reloads the card, it will actually reflect the updated atom, so the click handler wiring works indeed.is this an expected behaviour not to re-render on atom change if im using this dom-node
macro?
im asking here, because i thought it might be related to using devcards from figwheel.main...
@onetom the atom changing does not cause the card to change in this case https://github.com/bhauman/devcards/blob/master/src/devcards/core.cljs#L348
I think my thinking was that since this isn’t React you have to manage your changes manually anyway
i can't think of any benefit of leaving this nice little one-way dataflow mechanism out in the dom-node
case.
in my mental model, this data atom is the view-model of a card and it's an atom, so it can be monitored and the actual view recomputed from it.
it think it's irrelevant whether the view is described as a virtual or actual dom.
the current documentation didn't suggest any different behaviour either and that seemed very intuitive to me too
in case the re-rendering behaviour is undesired, one should just simply not use this initial atom and roll their own state management within the rendered component
I'm starting to try out figwheel-main, really liking it over figwheel so far. I have one question about reloads. In a re-frame scenario where I want to clear subscriptions on reloads I have used :on-jsload
to point to a reload fn. How should I port that kind of behavior to figwheel-main? Is it https://figwheel.org/docs/reloadable_code.html#setup-and-teardown-pattern that I'm supposed to use?
@bhauman Thanks, I'll check it out. And thank you for your hard work with such an awesome tool!
is there some architectural diagram, which explains how figwheel builds, the browser and the clojurescript repl is tied all together? im just wondering how to explain all this to my colleagues concisely enough... i foresee that i must also make an argument why the whole setup takes 20+ seconds to start and i think such a diagram might make them more forgiving 🙂
oh here’s the thing, if you have a lot of dependencies, there is a cost for clojure to load all of them on start
i've already removed rebel-readline
; i don't think that was the culprit.
im starting an nrepl server first, so i can eventually interact with the cljs-repl from cursive or vs code
and have the same instructions for dealing with the project irregardless what editor someone is using
btw, the code is open source.
im talking about this block-explorer
branch:
https://github.com/enumatech/cljs-abi-viewer/tree/block-explorer
I just ran it on a seemingly medium size project (a few thousand lines of code, very few deps) and it took about 8 seconds for the browser to launch. 2017 MBP though.
well, this project has zero deps, actually, outside of fighweel.main, figwheel.repl, cljs and clj
@bhauman btw, if you have some rough idea how would you visualize the architecture of figwheel, then just draw it on paper and i might be able to come up with a programmatic digital visualization of it with plantuml, graphviz, tikz or something.
however the start up time is largely composed of loading clojure code and compiling the clojurescript
Here is an example visualization I made to explain how an Ethereum node, the browser, the dapp in the browser and metamask browser extension is connected
Fogus put together a great set of graphics explaining clojurescript compilation in a few different possible setups: http://blog.fogus.me/2012/03/27/compiling-clojure-to-javascript-pt-3-the-himera-model/