Fork me on GitHub
#fulcro
<
2018-11-11
>
tony.kay07:11:24

I’ve finally updated the book so that I can switch the Lein template to shadow-cljs by default. A new version of the leiningen template is on clojars: - Uses shadow-cljs (I no longer support fighwheel at all) - The server is a hand-rolled, secure (CSRF, etc.) server - Now using nubank/workspaces instead of devcards - The template now uses mount instead of component - I dropped demos of i18n - There is a very obvious comment in the README and source on where you’d integrate Pathom, since it is what you should be using on the server for queries. This release is more in line with current best practices. Shadow-cljs is just better for real development. Period. Workspaces is much more flexible and extensible than devcards. The hand-rolled server is easy enough, and uses standard best practices and Ring Defaults. There are no longer options on the generator…just lein new fulcro application-name

❤️ 24
🎉 20
👍 20
claudiu19:11:27

@UCTNL1JNN case u missed it

pserrano19:11:39

Thanks, I really did miss it

tony.kay07:11:44

Updated book is live. Please let me know if there are errors/ommissions.

sooheon13:11:25

Omission: src/main/app/api/read.clj is missing in the template

tony.kay19:11:22

oh…the book mentions that but it isn’t in the template? Hm…guess I just need to tell you to create it or something

claudiu20:11:36

client :render-mode :keyframe is no longer the template default, is this on purpose ?

tony.kay20:11:25

never was a good idea I don’t think

Pontus21:11:41

under http://book.fulcrologic.com/#_the_function_as_a_child_pattern there's an example with: (:require ["react-motion" :refer [Motion spring]] -- I think this should be (:require ["react-motion" :refer (Motion spring)] to be valid shadow-cljs syntax

sooheon23:11:25

About api/read.clj, in addition to creating it and writing queries, should we also require it from another ns to get the queries to stick to the right multi method?

tony.kay05:11:29

I said that in the book...didn't I? @U06ANT2JK @U7BDL0WKU I was not aware of [] vs () making any diff

sooheon05:11:08

I recall hearing it in either the book or videos, but didn’t see it in the new version on first sight

sooheon05:11:31

Am going through again

sooheon05:11:00

@tony.kay what’s the nubank/workspace equivalent for :inspect-data true?

tony.kay05:11:00

@U06ANT2JK Fulcro Inspect 🙂

sooheon06:11:09

Cool. Is there a config option for Fulcro Inspect to always fully open up the data tree?

sooheon06:11:57

I guess searching for something and pressing enter is the quickest

tony.kay07:11:45

@eoliphant I’m not sure what you mean. I usually hook fulcro.server/server-mutate as the server-side pathom mutate hook so I can just use Fulcro’s defmutation on both sides…is that what you’re asking?

eoliphant15:11:44

hey sorry about that lol. I think I have all the server stuff figured out, i have pathom mutations/queries working fine on the server. But I also have a few 'client-only' pathom mutations that I've used to abstract/wrap some 3rd party libs' JS APIs. based on some back and forth on the subject a while ago. Granted I have have misunderstood some of it.

;before
(defmutation call-aws-or-something ..
 (action []
  (.callSomething aws-js ...)

; after
(pc/defmutation call-aws-or-something ...)
(def client-parser (p/async-parser ...  call-aws-or-something)..

(defmutation call-aws-or-something ..
 (action []
  (client-parser {}.. } )
Just trying to figure out if that is the recommended approach.

tony.kay19:11:59

You’d probably be better off adding a remote for it, and then making the normal defmutation choose that remote. Pathom, I think, has a fulcro remote wrapper that can act as a remote for a local pathom parser

eoliphant17:11:46

ah ok gotcha

sooheon10:11:46

Wow, the new dev setup is REALLY nice.

8
miridius11:11:59

hi @tony.kay (and of course the other Fulcro contributors), can I just say I'm super blown away and grateful for the huge amount of work you have done on Fulcro so far, not only in making it imho the best front end/full stack Clojure[script] framework available, but also in creating simply amazing documentation and training! Since starting to get into it 2 weeks ago (after having previously used everything from Om to Re-frame to Rum to Luminus) I've been constantly amazed and impressed 🙂 I'm just happy that I found out about it early enough in our product's development that we've been able pivot and rebuild what we had so far completely in Fulcro. It's been a dream! And then I just joined this channel only to find out you've made a new version of the template which includes quite a few of the things on my to-do list to add to my project, what perfect timing 😄

☝️ 4
fulcro 4
miridius11:11:57

I wanted to ask you though about your comments in the book about shadow-cljs being faster (and perhaps better) than figwheel, but the examples in your book all used lein-figwheel which as I understand has been deprecated some time ago. Have you tried using figwheel-main (https://figwheel.org/) and comparing that to shadow-cljs? In my not very expert opinion, figwheel-main is miles ahead of where lein-figwheel was!

miridius12:11:55

Yes I read that this morning, I'm guessing the author was also using lein-figwheel (but how can I know, since they never mention which figwheel!). It's a big problem that people often say "figwheel" without specifying which one they mean or even realizing that there's 2 completely different things which fall under that name. Perhaps figwheel-main should have been named something more distinct to avoid this confusion!

claudiu12:11:55

Yep. Also dont know about figwheel main, apart from podcasts. That's mainly because can't really find anything wrong with shadow-cljs. :)

claudiu12:11:59

Also curious about a comparison :)

miridius12:11:48

for me the biggest downside of shadow-cljs is that it depends on node, meaning for my CI build step I need an image with both clojure AND node installed which is a bit annoying/time consuming. But if you're going to use some node packages in your build anyway then there's no issue there 🙂 Figwheel-main also has nicer REPL tools imho and nicer in-page feedback for warnings/errors, but those might be just a matter of taste.

miridius12:11:45

Would be keen to hear what someone more experienced has to say though as I'm quite new to front-end work!

tony.kay19:11:44

So, the compiler tweaks the @U05224H0W has done around caching and NPM integration are pretty great. When I want to use something in my production work (and you will want to), it’s usually a very simple matter. With stock cljs I can’t tell you how many times I had to do things like clean the sources in order to get something working again. You’re right. I have not used figwheel-main, but my complaint was never really with figwheel, but more with many of the behaviors of the stock compiler.

tony.kay19:11:48

Hot code reload is a relatively trivial manner…in cljs it is just websocket push of the new js file…getting the compiler to work well, well, that is a different matter, and with shadow it “just works”…something I appreciate very much.

tony.kay17:11:15

I’ve updated the book’s comments. I had not intended to make figwheel sound bad…I think Bruce’s stuff is great, and figwheel isn’t even what I’m suggesting you move away from…I was trying to point out that shadow-cljs is a better overall production experience than the stock compiler (even though it uses the stock compiler internally). It is, however, the case that you no longer need figwheel once you’re using shadow.

j1mr10rd4n13:11:11

sorry, i couldn’t resist..

j1mr10rd4n14:11:33

*no criticism implied, nor offence intended…. is this first fulcro meme??