Fork me on GitHub
#pathom
<
2020-05-17
>
yenda09:05:24

the union-query example works with a parser but not with parallel-parser

yenda09:05:26

async-parser: {:search [{} {} {}]}
parallel-parser: {:search []}
parser: {:search [{:user/name Jack Sparrow} {:movie/title Ted} {:book/title The Joy of Clojure}]}

yenda12:05:02

So far the only solution I found was to make a reader instead of a resolver:

(def user-notifications
  {:user/notifications
   (fn [env]
     (go-catch
        (<! (join-seq-parallel (assoc env
                                      ::p/union-path
                                      (fn [{:keys [query] :as env}]
                                        (let [e (p/entity env)]
                                          (:notification/type e))))
                               n)))))})

yenda12:05:31

and to redefine join-seq-parallel so that it doesn't check if the query is a vector

wilkerlucio18:05:02

@yenda thanks for the report, looking into it now

yenda20:05:51

nice thanks! There is no solution for when you have a :type key for instance, because there isn't really any field unique to the entity?

wilkerlucio21:05:27

you can still use that, by overwriting the ::p/union-path on the pathom env, this can be a (fn [env]) so you have full control over what branch to pick