Fork me on GitHub
#fulcro
<
2021-08-31
>
Jakub Holý (HolyJak)06:08:18

Hello! I have created a survey for folks getting started with Fulcro, to get feedback on the Minimalist Tutorial and input on what to create next. Please fill it in https://forms.gle/TCRDixJx4t1r9jZp7 if you are the target audience and also provide feedback on the survey itself! Thank you!

souenzzo14:08:34

Hello fulcro community. I'm a little out of the news, as the last time that I worked with fulcro was with fulcro2. I'm planning to work on https://github.com/souenzzo/eql-realworld-example-app (and maybe move it to fulcro-community org) I would know, if I would develop an application like https://github.com/gothinkster/realworld, I would do it with fulcro-rad or should I do it without rad? RAD feels too much opinionated, as far I remember, it depends on semantic ui and other things like that.

😻 1
Jakub Holý (HolyJak)14:08:57

It does not depend on sem. UI, you can write your own UI plugin 🙂

Jakub Holý (HolyJak)14:08:18

Ideally, we would have both 😹

tony.kay14:08:57

This come up now and then, so let me clarify again what RAD is, and what it is not. RAD is a set of patterns and utilities, written IN Fulcro to help you stand up things quickly (if you understand it and Fulcro really well). RAD is a convenience layer, and a set of best-practice patterns for modeling your data, schema, and such in DRY and minimal manner, BUT, it is expected that you’ll eventually want/need to take over many of the functionalities that RAD does with plain Fulcro code at some point. The UI plugin is optional, so you can still generate all of the UI by hand if you want. The database adapters are also option, so you can just use Pathom. If you are aiming to make a production app, and I’d highly recommend using the RAD template as the base, even if you don’t use RAD to generate anything but the layout of your data model. Then it’ll be at your disposal if you want, but otherwise should not get in your way at all. IF you’re learning Fulcro, then avoid RAD altogether. Make sure you understand the core bits of Fulcro FIRST. RAD uses Dynamic routers, UI State Machines, emits defsc components, and requires that you understand EQL, idents, and initial state. It is not a shortcut for learning. I use it in every project to at least: • Manage my Datomic schema (via modeling with defattr) and the Datomic plugin. • Write id-based resolvers in Pathom for me. • Build quick reports/forms so I can tinker with data quickly But it is still a young library and I often have to tweak a thing or two.

✔️ 2
Jakub Holý (HolyJak)15:08:43

It seems that when load! returns {:<the server property> {}, :com.wsscode.pathom.core/errors :com.wsscode.pathom.core/not-found} b/c there is no resolver for the given sever property, Fulcro by default handles the request as a "success", correct? Is this optimal, at least for newcomers? Ah, wait, perhaps Fulcro is omitting by default not-found so that it will not replace any data it already might have?

sheluchin15:08:28

I have this simple resolver:

(pc/defresolver note-cards-resolver
  [{:keys [crux] :as env}
   {:note/keys [id]}]
  {::pc/input #{:note/id}
   ::pc/output [:note/id :note/card-list]}
  (log/debug "note-cards-resolver" {:note/id id})
  (let [card-list (get-card-ids-from-note crux {:note/id id})]
    {:note/id id
     :note/card-list card-list}))

(>defn get-card-ids-from-note
  [node {note-id :note/id}]
  [::ss/crux-node ::ss/note-entity
   => (s/coll-of ::ss/card-entity :kind vector?)]
  (->>
    (query node
     {:find '[id]
      :keys '[card/id]
      :where '[[card :type ::ss/card]
               [card :card/card-list card-list-id]
               [card-list :card-list/id card-list-id]
               [card-list :card-list/note note-id]
               [card :card/id id]]
      :args [{'note-id note-id}]})
    vec))
Whenever I try to use the Index Explorer, Load Index produces the following error:
java.lang.Exception: Not supported: class sheluchin.resolvers$note_cards_resolver__115952
It doesn't look to me like I'm returning anything that is difficult to serialize, so I'm presuming I don't need to do anything with install-type-handler!. What might the issue be? Why is it choking on this seemingly simple resolver?

Jakub Holý (HolyJak)15:08:54

Resolvers contain functions and those cannot be serialized over network and thus must be removed from the index response, which is transmitted over net. See https://github.com/fulcrologic/fulcro-rad-demo/blob/develop/src/datomic/com/example/components/parser.clj#L25

sheluchin16:08:17

@U0522TWDA wow, okay... it's that simple. Is that documented anywhere you know of by any chance? Thanks as always for your help.

sheluchin16:08:38

When you say "resolvers contain functions", do you mean my own resolvers that include function calls, or just vanilla parts of Pathom itself?

Jakub Holý (HolyJak)16:08:53

How did you know to create an index explorer resolver?

Jakub Holý (HolyJak)16:08:34

Index contains resolvers and each resolver is a map that contains a function, :resolve

sheluchin16:08:54

That's documented here https://blog.wsscode.com/pathom/v2/pathom/2.2.0/connect/exploration.html#_setting_up_the_index_explorer_resolver and that link comes up in the console log when the error is raised.

sheluchin16:08:42

But that index-explorer resolver does not filter out :resolve and :mutate the way that your RAD snippet does.

Jakub Holý (HolyJak)16:08:03

Where would you expect to find this info about filtering the index?

sheluchin16:08:57

https://book.fulcrologic.com/#warn-transit-decode-failed https://blog.wsscode.com/pathom/#_setting_up_the_index_explorer_resolver Both of those links are referred to when the error comes up after pressing Load Index in the Explorer. The first one in the console while the Index Explorer interface shows a link to the second one. I think both locations would be reasonable choices to highlight the filtering requirements.

Jakub Holý (HolyJak)17:08:32

Nice. Please send a PR to improve those!

👍 1
lgessler18:08:22

aside from RAD's defattr, do people have any favorite practices for keeping track of your data model, i.e. (I guess) all of your pathom attributes and how they fit together? I'm relying on a mix of documentation and comments right now but I wonder if anyone has a better solution

sheluchin19:08:20

Sounds like something the Index Explorer can help you with.

👍 2
xceno09:09:18

yeah I mainly rely on the index explorer as well, but if there are any other tools out there, I'd be interested to take a look too

lgessler16:09:16

ooh yes, index explorer, forgot about that

sheluchin16:09:57

@U49U72C4V if you haven't seen them yet, @U0522TWDA has a few Fulcro videos on YouTube that really helped me understand the value of the explorer. https://www.youtube.com/channel/UC2NO9W2DTZqUm2G1UPB2OWw

❤️ 2
lgessler16:09:51

I haven't, thanks for the link!