Fork me on GitHub
#pathom
<
2020-09-29
>
tvaughan13:09:26

I have this resolver:

(pathom-connect/defresolver session-id-resolver
  [{:keys [::pathom/parent-query]} {:keys [sessions/session-id]}]
  {::pathom-connect/input #{:sessions/session-id}
   ::pathom-connect/output [:sessions/session-id :sessions/user-id]}
  {:sessions/session-id :foobar
   :sessions/user-id 42})
When I make this query [{[:sessions/session-id :TODO] [:sessions/session-id :sessions/user-id]}] I get back {[:sessions/session-id :TODO] {:sessions/session-id :TODO, :sessions/user-id 42}}. Why do I get back :TODO instead of :foobar ? I'm using v2.2.31. Thanks

souenzzo13:09:54

@tvaughan once you do {[:a 42] [:a :b]} you already providing the value of :a, so it will call the resolver just to get the value of :b

wilkerlucio13:09:06

@tvaughan pathom will never override a value that is already in the entity, when you start with the ident, it set the value of that attribute, even if new resolvers get new values, the original value will be kept. if you consider that in Pathom the identity is the data itself, changing the data is like changing the identity, which leads to inconsistent data (if many resolvers use the same input property, with different values)

tvaughan13:09:17

Sure, that makes sense. I'm not advocating for a different behavior. Thanks for letting me know this is expected @souenzzo and @wilkerlucio

pathom 3
souenzzo13:09:02

@tvaughan see also: ::pc/mutation-join-globals It allow you to handle tempids For sessions, I use [{:app/current-session [:session/id :session/user-id ...]}]

souenzzo13:09:57

I started this repo but it need some attention/commits https://github.com/souenzzo/eql-style-guide

👏 6