pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
tvaughan 2020-09-29T13:17:26.013500Z

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

souenzzo 2020-09-29T13:20:54.014900Z

@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

wilkerlucio 2020-09-29T13:24:06.017500Z

@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)

wilkerlucio 2020-09-29T13:24:08.017800Z

makes sense?

tvaughan 2020-09-29T13:26:17.019500Z

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

1
souenzzo 2020-09-29T13:42:02.020900Z

@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 ...]}]

souenzzo 2020-09-29T13:42:57.021Z

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

👏 2