This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-05
Channels
- # aws (12)
- # babashka (30)
- # beginners (294)
- # calva (98)
- # clj-on-windows (3)
- # clojure (48)
- # clojure-europe (31)
- # clojure-italy (8)
- # clojure-nl (2)
- # clojure-uk (11)
- # clojurescript (58)
- # conjure (1)
- # events (1)
- # fulcro (35)
- # graalvm-mobile (2)
- # jobs (8)
- # lsp (11)
- # malli (25)
- # off-topic (33)
- # pathom (24)
- # pedestal (1)
- # polylith (15)
- # re-frame (7)
- # reitit (10)
- # releases (8)
- # remote-jobs (2)
- # sci (3)
- # shadow-cljs (79)
- # spacemacs (10)
- # sql (17)
- # tools-deps (17)
- # vim (4)
- # xtdb (11)
Not sure if it's best to ask here or in #vim, but is there some way to get guardrails errors to show up in my editor and not just in the browser console? I'm using vim-iced.
What (clojure datalog or not?) db would you folks suggest to use with Fulcro if you had the freedom in a greenfield project? I'm thinking of learning Crux because that seems cool. I'm also looking at this Datahike one, or maybe Asami...or datalevin. What do you think is the most "Fulcro-ish"?
And then you will also need an actual backend? I've seen Pedestal mentioned a couple times in relation with Fulcro. I ran into this too. https://github.com/jlesquembre/pathom-pedestal
Basically I just want to see if I can learn full stack web applications from top to bottom in Clojure. If you could just go all Clojure, what would your whole stack look like?
I have the time freedom to do so even though I recognize I've bitten off way more than I can handle already in learning Fulcro with my already limited web dev experience.
I've chosen datomic for my greenfield project last year (+ datomic ions) and I'm very happy. But a friend of mine went with crux in his project and it seems very cool as well. So I'd say, if you want to go the Open Source route - choose Crux or Postgres, otherwise datomic. > If you could just go all Clojure, what would your whole stack look like? The stuff that's in the RAD demo is a nice start. I went with that + some minor modifications. > have the time freedom to do so even though I recognize I've bitten off way more than I can handle already in learning Fulcro with my already limited web dev experience You'll be in for a ride and I think you should at least skim the following thread 😉 https://clojurians.slack.com/archives/C68M60S4F/p1625065156313600?thread_ts=1625054514.312100&cid=C68M60S4F
Despite that, I also can't fight the temptation to chat with my fellow clojure slack folks about these things before I'm ready. haha
(Probably why I hadn't looked too closely at the RAD part yet to see if it covers the backend because the docs say "Just learn Fulcro really well first!"
I'm trying to decide which database to use as well. There's a pretty strong case to be made for using something you're familiar with like Postgres if you already feel overwhelmed by Fulcro. I'm personally leaning in that direction until my own greenfield project is a bit more mature. At some point I would definitely like to start a branch and swap out Postgres with Datomic or Crux. I'm eager to learn those, but I think it's better not to try to do too many new things all at once. Going through the practice of changing the datastore once you have the other parts of your app figured out and working would probably be a good exercise.
I only have some experience with sqlite (and really struggle to get postrgres setup correctly) so figured I don't even have to worry about "use what I know" cuz I don't know anything! haha
Sounds like Crux is more popular with the Fulcro crowd over these other open source datalog options like datahike and asami then
> docs say "Just learn Fulcro really well first!" Yes that's true, you should probably take the time to set up a little demo backend and then play with fulcro before starting a real project. When you say you're new to web-dev, don't forget that there's a whole world of other crap you need to worry about as well... Security, Understanding HTTP Headers, how payloads look like, where they are, etc.
I do have some of those basics down but yeah, it's definitely a daunting list of things to learn. I've just been slowly going through the steps found in the community guide: https://fulcro-community.github.io/guides/tutorial-minimalist-fulcro/
Then you might indeed be able to use your inexperience to your advantage. I'm always trying to map new concepts to concepts I'm familiar with already from using more traditional frameworks. Sometimes the baggage of past experience gets in the way a bit 🙂
I'm just saying this because I recently helped another senior dev who did c++ backends / microcontroller stuff for a decade and he got quickly overwhelmed when I showed him a typical "full-stack" application. > Sometimes the baggage of past experience gets in the way a bit That is SO true. Well, at least you won't have to unlearn years of MVC patterns and whatnot haha
It mirrors when I learned Clojure as one of my first languages. I didn't have to "unlearn" the bad OOP habits or whatever. TBH, I still struggled a lot until I did Harvard's CS50 course (using C and then Python) but now I feel I have the skills to be a junior developer if I wanted to (I don't, I want to create my own Clojure web apps for fun and profit)
@U9J50BY4C I am learning Crux as well and have liked it a lot. If you decide for it, here’s a nice template you could use, it also uses pedestal 😉 https://github.com/dvingo/dv.fulcro-template
Yeah Datomic is probably a great choice but I'm going to stick with Open Source for now
Nice! 😄
I think that'll be my plan then. Work through the Fulcro documentation as Tony Kay advises while slowly expanding my ability to understand everything going on in that template cuz it seems to align with how I was thinking of approaching this (crux, reitit, pedestal, malli, etc.)
I'm stoked a lot of you are going through this same journey. I figure I have a year or two to really get this stuff down so hopefully we can all progress together
Armed with what I’ve learned from @holyjak’s tutorials, I’m attempting to write a simple Fulcro RAD application that loads from the server a bunch of stories with schema {:story-list/id [:story/id :story/author :story/title]}
This will be displayed on the left pane, and the full story will be displayed on the right pane, which is stored in a singleton value {:current-story [:story/content :story/author :story/id]}
(it’s like an entry in story-list, but with :content
assoced in, which can be quite long, and is loaded by a mutation.)
I wrote a RAD component as such:
(report/defsc-report StoriesCustom [this {:ui/keys [current-rows parameters]
:as props}]
{ro/title "Stories List"
ro/source-attribute :story-list/all-stories
ro/query-inclusions [{:current-story (comp/get-query FullStory)}]
ro/row-pk story-list/id
ro/columns [story-list/id story-list/author story-list/title]
ro/run-on-mount? true
ro/route "stories"}
(dom/div
(println "current story: " (:current-story props))
(dom/p "Hello 2")
(map ui-story current-rows)
(ui-full-story (:current-story props))))
My problem: current-story
is always nil, and I can’t figure out why.
(I was ridiculously happy with quickly this app came together: mutation is setting :current-story
, story-list is rendering, each with a button w/a mutation to set it to current story
— the Fulcro Inspector screenshot shows that those are all being set propery.)
Is it because I’ve somehow messed up query or ident to FullStory component, which is below?
Many thanks!!
(comp/defsc FullStory [_ params]
{:query [:story/id :story/content :story/title :story/author]
:ident :story/id}
(println "FullStory: params: " params)
(dom/div (dom/h2 "Full Current Story: " (:story/content params)
(dom/p (str (:story/id params)
(:story/author params)
(:story/title params)
(:story/content params)))
(dom/div {:dangerouslySetInnerHTML {:__html "<strong> hello! </strong"}}))))
(def ui-full-story (comp/factory FullStory {:keyfn :story/id}))
Fulcro Inspector shows {:current-story […]} is correctly set to a value. And yet, when I try to print out the value in the StoriesCustom component, pulled in through ro/query-inclusions
, it shows up as nil
.
How do I access :custom-story
, either in a Fulcro RAD component?
(Come to think of it, in another non-RAD application, I was able to access :custom-story
in a standard Fulcro component, but that doesn’t appear to be working in a RAD application?)
so your query inclusion should be {[:current-story '_] (comp/get-query FullStory)}
or you need to target your load so that you place an ident into the path of the report
Reports are at ident [::report/id FQCN]...so the load target would be [::report/id ::FullStory :current-story]
If you make a pathom resolver that properly resolves current-story from no input, then it would "just work"
not sure how you're hooking it up...but a defresolver with no ::pc/input
, and a ::pc/output of [{:current-story [:story/id]}]
would do it. Of course, I'd use a better nsed kw for that
but the assumption is current story is somehow stateful? Pathom isn't going to work unless that state is in the server session...so, again, seems like perhaps what you really want is the link query
A “link query” — it works! Thanks, @U0CKQ19AQ! https://book.fulcrologic.com/#_link_queries Onwards! 🙂