This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-08
Channels
- # announcements (2)
- # beginners (75)
- # cider (2)
- # clj-kondo (8)
- # cljs-dev (4)
- # clojure (69)
- # clojure-europe (4)
- # clojure-nl (6)
- # clojure-uk (1)
- # clojurescript (17)
- # clojureverse-ops (1)
- # cursive (7)
- # lsp (7)
- # malli (10)
- # missionary (2)
- # off-topic (16)
- # pathom (4)
- # polylith (5)
- # portkey (1)
- # reitit (4)
- # rewrite-clj (1)
- # shadow-cljs (5)
- # spacemacs (3)
- # specter (3)
- # xtdb (14)
Im trying to learn pathom by building a simple CRUD api, and I wonder what is the pattern (if there is one) on what is returned on mutations? should I return on update/create?
usually you can return the map of the just created entity, so the user can read from it if desired
Consider a schema where a "user" has a "cart"
When the user call (create-cart {})
, I would return
(pc/defmutation create-card ....
{:user/id ...
:cart/id ...})
Then, the frontend can call both:
[{(create-cart {}) [:user/name {:user/cart [:cart/id :cart/empty?]}]}]
[{(create-cart {}) [:cart/id :cart/empty?]}]