Fork me on GitHub
Chris O’Donnell03:04:15

Published a couple more blog posts to my fulcro + pathom series at One implements a couple of pathom parser tests, and the second adds authentication and basic authorization to API calls. Always happy to hear any feedback. 🙂

simple_smile 28

thanks for doing this!

👍 8

fulcro needs more blog posts


I dropped one down myself as a review post, super impressed with what comes out of the box…

fulcro 12

Hunted down the link to your blog post, hope you don’t mind me sharing it here @U0JUM502E


Ah, no problem =)…


That's awesome! Thanks for sharing @U0DUNNKT2

👍 4
Jakub Holý (HolyJak)08:04:31

@tony.kay Regarding ☝️ , how can I get access to the ::pathom/errors part of the response? When I look at the response or its :body inside a :remote-error? function, it is nowhere to be found. (And there is :error :none, :error-text nil) Do I need to add a :global-eql-transform that adds ::pathom/errors to every query to be able to read it?


Yes, global-query-transform is the perfect place for that kind of thing. Sorry that isn’t in the book…that’s what I do on my projects.

Jakub Holý (HolyJak)11:04:59

The defmacro docstring does not really describe the handler names supported out of the box such as action, ok-action, refresh, ... . Where are they documented? Thanks!


The default-result-action is the place for that doc, since the macro does nothing more that look up what you’ve configured on the app and calls it.


Hi, a fulcro and clojure newbie here. I think I’ve learned a lot of new concepts thanks to the awesome documentation and video series, but I’m still struggling a bit. I have a product, product list and product editor like so.

(defsc Product [this {:product/keys [id name]}]
  {:query         [:product/id :product/name]
   :ident         :product/id})

(defsc ProductEditor [this {:product/keys [id name description]}]
  {:query [:product/id :product/name :product/description]
   :ident :product/id})

(defsc ProductList [this {:product-list/keys [items selected-product]}]
  {:ident         (fn [] [:component/id ::product-list])
   :query         [{:product-list/items (comp/get-query Product)}
                   {:product-list/selected-product (comp/get-query ProductEditor)}])
I can transact a new product into the :product/id table and its ident into the product list :component/id { ::product-list { :product-list/items } } . I can also edit the attributes of the newly made product (in the ProductEditor) and it’s values are changing in the :product/id table which is reflected in the product list and editor. I also have a similar setup for :process/id . My problem is, that I need to be able to add processes to the product. I naively tried to just make an options list directly out of the app state atom, but of course the process options list doesnt know it needs to update if a new process is made. I also tried to get-query from ProcessList, but I kept getting nil. Should I have subcomponent with the same ident as ProcessList or something like that? I’m not sure if I’m on the right track at all.


If product is to have many processes then I would expect to see :product/processes (as a join so comp/get-query to a Process component) in a component that has :product/id as its ident. Then in a mutation you would need to be creating the process (a map at [:process/id id]) and reference to it (an ident at [product/id id :product/process]) in app state.


Thanks for replying. Yes a product can have many processes. I sort of get the idea of adding a process to a product, but what I’m actually struggling with is displaying the processes that you can choose from (which is all the processes). In a way the “process options”-list doesn’t belong to a product, but is in fact something global. How should you go about querying for global data in a simple component? Should you even?


Now that I have thought about this more, I actually think I should just add something like :ui/options and give it the proper list ident


That's a good question. I did end up storing all lookup information in app state in three components. But I don't know if I would recommend that necessarily. This kind of problem is talked about in the videos if you watch them. But if you need the selected process that is :product/process, and if you need all of them then that is :ui/processes, which is what you have as :ui/options, because as you can see, you don't want to be querying for the processes every time - the query for them fits well as a df/load from :client-did-mount. So I think your solution is good.

🙏 4

Looking at server config section, it doesn’t mention how to do defaults? Is it possible to lookup an env var and if that fails, default to some value?


put env lookup in defaults.edn, and the override in your specific config file (i.e. prod.edn). if you mean “a default if it isn’t configured in files”: CLJ already has a way…`(get config key dflt)`


Got it use the (get config key dflt) in code.