Fork me on GitHub
#fulcro
<
2021-05-26
>
Björn Ebbinghaus11:05:33

Nice. Two comments. L296 ((comp/factory Address) address) I think this shouldn't be thought. 🙂 L318 [(h1 "Teams") (map ui-team teams)] This will lead to warnings from react, because of missing keys, doesn't it?

1
Björn Ebbinghaus11:05:58

L318 as well: (cond loading? (...) :else (...))(if loading? (...) (...) Except for when you want the reader to use more states beside loading

(cond 
  (df/loading? marker) (p "Loading...")
  (df/failed? marker) (p "Failed." (button "Load again"))
  :else (...) 
Or
(let [status (:status marker)]
  (case status 
    :loading (p "Loading...")
    :failed (p "Failed." (button "Load again"))
    (...)

holyjak17:05:59

Right. It is extracted from code that had more conditions but you are right that of makes more sense here.

holyjak19:05:30

@U4VT24ZM3 Could you please explain what you mean by your first comment regarding L296? Of course I could have defined the factory separately but this also goes, no?

Björn Ebbinghaus19:05:09

Sure. It „works“ but I would consider it bad style. I would always write (def ui-address (comp/factory Address))

holyjak19:05:34

I have it from the second code example under https://book.fulcrologic.com/#_demo_using_unions_as_a_ui_type_selector Why is it "bad"? Because you create a new factory on each render, perhaps, and thus it is not efficient?

Björn Ebbinghaus19:05:14

I think it's just a style thing. 🙂

Björn Ebbinghaus19:05:49

Better readable code, less code repetition ... You know? Performance could be a thing as well I guess.

1
holyjak19:05:31

In general I also def factories separately, so we agree here. I only make an exception, well, exceptionally 🙂 Regarding the cond - I left it as is but inserted a line with ;; ... before the else to hint that more cases could be handled there (as is the case in the Minim. F. Tutorial that this exercises are meant for). Thanks a lot!

Björn Ebbinghaus23:05:33

Thank you for your work. I always felt (and was told) that fulcro is somewhat hard to learn. And I contribute that to the small amount of beginner material and be it questions on StackOverflow. That's the reason why I decided to ask questions in the GitHub discussion section. 🙂 Slack is nice to talk "face-to-face", but it doesn't generate lasting value in the form of learning material.

👍 2
❤️ 1
holyjak07:05:03

It is harder to learner also because it covers more and does more. Helix is trivial - but it has only UI, no idea of data and remote access. But you are right, materials are a part of it.

Oliver21:05:31

The fulcro developers guide is awesome and explains everything in a way that even a beginner can grasp. Re-frame documentation is certainly more fun to read but only scratches the surface. If only there were some video tutorials for beginners in fulcro that would certainly help.

holyjak21:05:44

What kind of tutorials do you have in mind? Tony has made a ton of videos...

Oliver04:06:28

I guess it depends how you define "beginner". I am watching Tony's Fulcro 3 series for several weeks now, because I find this stuff very interesting. I would not say that this series is for beginners unless you have some experience with building web applications on some other software stack. There are simply too many things you need to learn at once and some major aspects are not (and cannot be) subject of these videos, e.g. it took me some time to set up the configuration on emacs. Compare it to reagent or reframe: you will find videos on the internet where people hack together really basic stuff and you can get a rough idea of it after watching and spending some hours playing around with that stuff. Then you can go and grab some good online course (e.g. from Eric or Jacek) if you are really interested in learning the whole thing. Personally I don't see that the Fulcro architecture is more difficult to understand than the one of Reframe but my first impression was exactly this. So basically what I am trying to say is that there is excellent material available but the appetizers are missing. ;-)

✔️ 1
👍 2
holyjak08:06:07

If you come upon a good video that matches this for reagent or some other framework, please let me know! It is also a question of how much it should teach: Emacs config? ClojureScript? JavaScript interop? React? HTML and CSS? ... I am not sure where the boundary should go....

👍 1
Oliver19:06:32

Jacek Schae has made the first parts of his classes for Reagent and Reframe available for free. The one on Reagent helped me a lot to put together all the pieces I had in my head after reading documents and looking at various examples on GitHub. There is also a lot of very good stuff around for Clojure and ClojureScript. Emacs/Spacemacs is also covered quite well, there are excellent videos by John Stevenson but focussed on Clojure. I had some difficulties in mimicking Tony‘s setup for Fulcro with shadowcljs but I figured it out after some tries and some help from Slack. You can definitely make your way through all the basics if you stay on the ball. Examples what I still find difficult after reading your tutorials and Tony‘s videos and documentation are understanding the graph database „syntax“ of Pathom and Fulcro and how this would translate to a relational database on the backend. I am still searching for some good material for this. It really depends on where you are coming from. I have my background on large and complex data integration frameworks, never messed around with UIs, no Java, no OO. So maybe not the best example for a typical beginner. 😉

holyjak09:06:43

Thank you! So you main challenge is understanding what Pathom resolvers to write and how to map those to an underlying SQL DB, correct?

👍 1
Oliver05:06:34

Yes, exactly.

Marcus22:05:03

does anyone know why I get this warning when I use a union with initial-state? get-ident returned an invalid ident: [nil nil] nil

holyjak07:05:35

I guess the props passed to the component are nil , no? Is that expected or a mistake? Does it make sense to render the component without any data? If it does then either ignore the warning or use :initial-state {} (+ propagating it all the way up) to make sure there are non-nil props. But given then this ident seems dynamic, i.e. props-dependent, why would you render the component when it has no props? What surprises me is [nil nil] , should it not be [:some-entity-name/id nil] ? Also, do you have latest Fulcro? I would expect some of the warnings inside it to be triggered?! See https://github.com/fulcrologic/fulcro/blob/develop/src/main/com/fulcrologic/fulcro/components.cljc#L630

Marcus08:05:45

Hi! I will check. The problem is that this is a union. Initial state is calculated from the child component and thus should always pass on values to use as the ident.. (as I understand it).

Marcus08:05:14

it is nil nil and not some-entity/id nil because the union component supports different entity types

Marcus08:05:37

so the ident is defined as (defn []  [type id])

Marcus10:05:22

Upgraded to latest 3.4.22. Same message.

holyjak12:05:24

I am not familiar with unions. But it still looks like initial state issue to me (and you can check that by looking into the client db). Also, why is type nil? That should likely not happen?

holyjak12:05:36

can you share a gist of the relevant code?

Marcus10:06:10

Sorry for the late reply. The code is as follows:

(defsc Step [this {:keys [id type] :as props}]
  {:initial-state (fn [params] (comp/get-initial-state Start))
   :query (fn [] {:start (comp/get-query Start)
                  :length (comp/get-query Length)})

   :ident (fn [] [type id])
   }

Marcus10:06:26

But I think I will let it be for now.

Marcus11:06:10

@U0522TWDA btw, I read you blog... we're both in Norway. I live in Stavanger. I don't think there are too many Clojure or at least Fulcro developers around here.

holyjak11:06:04

Oh, nice! Now, last time I mentioned Fulcro in #clojure-norway I got no reaction. I have some job to do here. Man må aldri gi opp... 🙂

Marcus11:06:37

haha.. det er sant... jeg melder meg inn i kanalen så kan jeg svare 😉

Marcus22:05:07

the app renders fine.. it is only initially it is passed null values for the ident

Oliver04:06:28

I guess it depends how you define "beginner". I am watching Tony's Fulcro 3 series for several weeks now, because I find this stuff very interesting. I would not say that this series is for beginners unless you have some experience with building web applications on some other software stack. There are simply too many things you need to learn at once and some major aspects are not (and cannot be) subject of these videos, e.g. it took me some time to set up the configuration on emacs. Compare it to reagent or reframe: you will find videos on the internet where people hack together really basic stuff and you can get a rough idea of it after watching and spending some hours playing around with that stuff. Then you can go and grab some good online course (e.g. from Eric or Jacek) if you are really interested in learning the whole thing. Personally I don't see that the Fulcro architecture is more difficult to understand than the one of Reframe but my first impression was exactly this. So basically what I am trying to say is that there is excellent material available but the appetizers are missing. ;-)

✔️ 1
👍 2