Fork me on GitHub
#pathom
<
2020-07-27
>
ak-coram09:07:42

one of my resolvers always gets called twice with the same input, are there any common mistakes that can lead to this?

yenda13:07:34

it's normal if you are doing a parallel parser and some fields are resolved in parallel withthe same input. For instance if you are resolving a list of comment and the user associated with each comment while the user commented more than once

yenda13:07:33

is there a way to not return keys instead of pathom-not-found? or at least nil so that booleans don't end up being truthy?

souenzzo13:07:05

@yenda there is a p/elide-special-outputs-plugin plugin 😉

yenda13:07:51

what does it do exactly?

souenzzo13:07:49

Something like it

(letfn [(elide-special
          [el]
          (cond
            (map? el) (into {}
                            (keep (fn [[k v]]
                                    (when-not (contains? #{::p/not-found
                                                           ::p/error}
                                                         v)
                                      [k (elide-special v)])))
                            el)
            (coll? el) (mapv elide-special el)
            :else el))]
  (let [result (<! (parser env tx))]
    (elide-special result)))