This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-08
Channels
- # announcements (6)
- # babashka (78)
- # beginners (84)
- # bristol-clojurians (5)
- # calva (50)
- # chlorine-clover (45)
- # cider (14)
- # clj-kondo (18)
- # cljs-dev (2)
- # clojars (2)
- # clojure (387)
- # clojure-android (3)
- # clojure-europe (6)
- # clojure-gamedev (3)
- # clojure-germany (3)
- # clojure-nl (18)
- # clojure-spec (5)
- # clojure-uk (36)
- # clojurescript (8)
- # clojurex (1)
- # conjure (1)
- # css (1)
- # cursive (32)
- # data-science (1)
- # datomic (11)
- # docker (61)
- # duct (17)
- # emacs (7)
- # figwheel-main (3)
- # fulcro (19)
- # jobs-discuss (3)
- # joker (1)
- # leiningen (23)
- # malli (11)
- # mount (6)
- # off-topic (30)
- # pathom (14)
- # pedestal (2)
- # phzr (1)
- # re-frame (11)
- # reagent (3)
- # reitit (5)
- # ring-swagger (3)
- # rum (1)
- # shadow-cljs (113)
- # slack-help (9)
- # spacemacs (16)
- # specter (4)
- # sql (14)
- # vscode (2)
- # windows (3)
- # xtdb (12)
Published a couple more blog posts to my fulcro + pathom series at https://chrisodonnell.dev/. 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. 🙂
fulcro needs more blog posts
I dropped one down myself as a review post, super impressed with what comes out of the box…
Hunted down the link to your blog post, hope you don’t mind me sharing it here @U0JUM502E https://folcon.github.io/posts-output/2020-04-07-Fulcro-Review-PLUS-websockets/
@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.
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.
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?