This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-08
Channels
- # announcements (1)
- # babashka (28)
- # beginners (13)
- # calva (10)
- # clerk (18)
- # clj-on-windows (39)
- # clj-otel (1)
- # cljdoc (17)
- # clojars (12)
- # clojure (40)
- # clojure-austin (11)
- # clojure-brasil (1)
- # clojure-europe (23)
- # clojure-nl (3)
- # clojure-norway (16)
- # clojure-uk (2)
- # clojurescript (28)
- # clr (4)
- # conjure (1)
- # emacs (14)
- # hoplon (6)
- # hyperfiddle (59)
- # interop (2)
- # leiningen (1)
- # off-topic (37)
- # pathom (1)
- # polylith (5)
- # portal (7)
- # reagent (9)
- # releases (3)
- # shadow-cljs (22)
- # spacemacs (6)
- # tools-build (12)
- # tools-deps (51)
- # web-security (6)
- # xtdb (7)
(do
(pco/defresolver items
[env qp]
{::pco/input [:limit]}
(tap> {:qp qp
:params (pco/params env)})
{:items [{:item/id 1}
{:item/id 2}
{:item/id 3}]})
(pco/defmutation item-writer
[env params]
{::pco/params [{:items [:item/id]}
:limit]}
(print (:limit params)))
(p.eql/process (-> (pci/register [items item-writer])
(p.plugin/register pbip/mutation-resolve-params))
[`(item-writer {:limit 2})]))
tap> {:qp {:limit 2}
:params {}}
2
=> {playgrounds.pathom/item-writer nil}
Is there a way to call a mutation with some params and also have access to those params in the resolver used in the mutations ::pco/params
? I have it somewhat working here, but the resolver has to accept the params as inputs which doesn't seem like the right semantics.
I could also change the defmutation like so:
{::pco/params [{'(:items {:some-param "xyz"}) [:item/id]}
:limit]}
in which case the "xyz"
does make it to the resolver, but I want this to be a dynamic value.
I'm ultimately trying to create a defmutation that receives its inputs from a resolver and I want the mutation to support pagination paramaters.