This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-31
Channels
- # announcements (3)
- # aws-lambda (1)
- # babashka (122)
- # beginners (241)
- # calva (28)
- # cider (7)
- # clara (7)
- # clj-kondo (43)
- # clojars (5)
- # clojure (326)
- # clojure-europe (60)
- # clojure-italy (2)
- # clojure-nl (4)
- # clojure-spec (21)
- # clojure-uk (4)
- # clojurescript (162)
- # cursive (30)
- # datomic (3)
- # editors (5)
- # emacs (4)
- # figwheel-main (1)
- # fulcro (24)
- # gratitude (3)
- # helix (7)
- # honeysql (20)
- # improve-getting-started (1)
- # introduce-yourself (11)
- # jobs (3)
- # joker (2)
- # kaocha (15)
- # lsp (21)
- # lumo (2)
- # meander (3)
- # off-topic (34)
- # re-frame (6)
- # reagent (1)
- # releases (4)
- # rum (2)
- # shadow-cljs (37)
- # spacemacs (16)
- # tools-deps (16)
- # vim (23)
- # xtdb (32)
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!
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.
It does not depend on sem. UI, you can write your own UI plugin 🙂
Ideally, we would have both 😹
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.
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?
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?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
@U0522TWDA wow, okay... it's that simple. Is that documented anywhere you know of by any chance? Thanks as always for your help.
No idea
When you say "resolvers contain functions", do you mean my own resolvers that include function calls, or just vanilla parts of Pathom itself?
How did you know to create an index explorer resolver?
Index contains resolvers and each resolver is a map that contains a function, :resolve
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.
But that index-explorer resolver does not filter out :resolve and :mutate the way that your RAD snippet does.
Where would you expect to find this info about filtering the index?
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.
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
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
@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