the union-query example works with a parser but not with parallel-parser
async-parser: {:search [{} {} {}]}
parallel-parser: {:search []}
parser: {:search [{:user/name Jack Sparrow} {:movie/title Ted} {:book/title The Joy of Clojure}]}
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)))))})
and to redefine join-seq-parallel
so that it doesn't check if the query is a vector
@yenda thanks for the report, looking into it now
@yenda fixed by: https://github.com/wilkerlucio/pathom/pull/161 going to release alpha-8
soon
also add new docs on unions + connect: https://wilkerlucio.github.io/pathom/v2/pathom/2.2.0/connect/resolvers.html#_union_queries
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?
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