fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
sheluchin 2021-07-05T14:37:08.379Z

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.

Chase 2021-07-05T16:30:16.379400Z

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"?

Chase 2021-07-05T16:30:29.379500Z

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

Chase 2021-07-05T16:30:42.379800Z

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?

Chase 2021-07-05T16:30:48.380Z

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.

xceno 2021-07-05T16:38:18.380500Z

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

Chase 2021-07-05T16:40:34.380900Z

Yep, I definitely read that and was like, I'm going to do this right.

Chase 2021-07-05T16:41:00.381100Z

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

Chase 2021-07-05T16:41:58.381300Z

(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!"

sheluchin 2021-07-05T16:42:34.381500Z

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.

Chase 2021-07-05T16:44:04.381700Z

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

Chase 2021-07-05T16:44:36.381900Z

Sounds like Crux is more popular with the Fulcro crowd over these other open source datalog options like datahike and asami then

xceno 2021-07-05T16:44:38.382100Z

> 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.

Chase 2021-07-05T16:45:36.382400Z

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/

sheluchin 2021-07-05T16:46:51.382700Z

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 🙂

xceno 2021-07-05T16:47:56.382900Z

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

sheluchin 2021-07-05T16:49:31.383100Z

It seems like there is more Fulcro documentation around Datomic than other DBs.

Chase 2021-07-05T16:49:51.383300Z

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)

Mardo Del Cid 2021-07-05T16:50:14.383500Z

@chase-lambert 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

👍 2
Chase 2021-07-05T16:50:17.383800Z

Yeah Datomic is probably a great choice but I'm going to stick with Open Source for now

Chase 2021-07-05T16:50:37.384100Z

I have that template bookmarked already! haha

Mardo Del Cid 2021-07-05T16:51:14.384400Z

Nice! 😄

Chase 2021-07-05T16:54:49.384600Z

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.)

Chase 2021-07-05T16:56:09.384800Z

If that is based on just the Fulcro template is it deviating heavily from Fulcro-RAD?

Chase 2021-07-05T16:58:16.385100Z

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

🍻 3
genekim 2021-07-05T18:27:41.394400Z

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}))

genekim 2021-07-05T18:35:19.394700Z

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?)

tony.kay 2021-07-05T18:58:34.395100Z

You loaded current-story into the root of the db

tony.kay 2021-07-05T18:59:30.395300Z

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

tony.kay 2021-07-05T19:00:12.395500Z

Reports are at ident [::report/id FQCN]...so the load target would be [::report/id ::FullStory :current-story]

tony.kay 2021-07-05T19:00:50.395700Z

If you make a pathom resolver that properly resolves current-story from no input, then it would "just work"

tony.kay 2021-07-05T19:02:01.395900Z

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

tony.kay 2021-07-05T19:02:37.396100Z

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

genekim 2021-07-05T19:04:20.396800Z

Thank you! Will study this and try again later today! 🙏🎉

genekim 2021-07-05T21:34:02.397Z

A “link query” — it works! Thanks, @tony.kay! https://book.fulcrologic.com/#_link_queries Onwards! 🙂