This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-15
Channels
- # announcements (2)
- # babashka (41)
- # beginners (10)
- # calva (62)
- # chlorine-clover (70)
- # cider (19)
- # clara (2)
- # clj-http (1)
- # clj-kondo (1)
- # cljs-dev (3)
- # cljsrn (8)
- # clojure (168)
- # clojure-austin (1)
- # clojure-australia (2)
- # clojure-canada (1)
- # clojure-europe (15)
- # clojure-france (9)
- # clojure-nl (3)
- # clojure-serbia (5)
- # clojure-spec (14)
- # clojure-uk (8)
- # clojurescript (14)
- # community-development (30)
- # core-async (42)
- # core-typed (1)
- # datahike (2)
- # datalog (23)
- # datomic (4)
- # emacs (4)
- # figwheel-main (4)
- # fulcro (67)
- # ghostwheel (4)
- # girouette (1)
- # gorilla (7)
- # graalvm (11)
- # heroku (8)
- # integrant (42)
- # jobs (6)
- # jobs-discuss (47)
- # kaocha (7)
- # lambdaisland (2)
- # leiningen (5)
- # lsp (29)
- # off-topic (1)
- # pathom (9)
- # portal (6)
- # re-frame (5)
- # reagent (11)
- # releases (6)
- # remote-jobs (10)
- # shadow-cljs (112)
- # testing (55)
- # vrac (1)
Is it necessary to specify ::pc/output
of a resolver? I’ve noticed that if I don’t query for any keys that exist in the ::pc/output
vector, then my resolver stops working (all keys are :not-found
).
yes, that’s required, there are a few cases in which Pathom can infer the output, but only very simple cases, for the most part you need to define the output
Ah right. It took me too long to realize, but without the output you wouldn’t know which resolver to actually call…
But if I query for even one key that matches what’s in ::pc/output
, now it’s able to find keys that weren’t declared ahead of time.
this happens because pathom just merges the result, and them you kind get it by accident
think that pathom uses ::pc/output
to generate the attribute index, if you try to lookup for something and its not there, pathom will make it not-found
this is how you can get the “work by accident” case:
(pc/defresolver x []
{::pco/output [:a]}
{:a 1 :b 2})
(parser [:a :b])
the :a
attribute made pathom call x
, which had the full result merged (`{:a 1 :b 2}`), now, when looking for :b
it sees its already on the entity data, so it works
but if you remove :a
from this query (as : (parser {} [:b])
), it wont, because :b
isn’t indexed