Fork me on GitHub
#fulcro
<
2021-07-05
>
sheluchin14:07:08

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.

Chase16:07:16

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

Chase16:07:29

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

Chase16:07:42

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?

Chase16:07:48

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.

xceno16:07:18

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&amp;cid=C68M60S4F

Chase16:07:34

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

Chase16:07:00

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

Chase16:07:58

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

sheluchin16:07:34

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.

Chase16:07:04

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

Chase16:07:36

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

xceno16:07:38

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

Chase16:07:36

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/

sheluchin16:07:51

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 🙂

xceno16:07:56

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

sheluchin16:07:31

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

Chase16:07:51

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 Cid16:07:14

@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

👍 4
Chase16:07:17

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

Chase16:07:37

I have that template bookmarked already! haha

Chase16:07:49

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

Chase16:07:09

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

Chase16:07:16

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

🍻 6
genekim18:07:41

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

genekim18:07:19

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.kay18:07:34

You loaded current-story into the root of the db

tony.kay18:07:30

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.kay19:07:12

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

tony.kay19:07:50

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

tony.kay19:07:01

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.kay19:07:37

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

genekim19:07:20

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

genekim21:07:02

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