Fork me on GitHub
#pathom
<
2019-04-30
>
kszabo01:04:51

@wilkerlucio I essentially wanted to write ‘This mutation requires these parameters explicitly and these resolver’s outputs implicitly, Connect resolve the latter for me please’ your way is the manual version of that. I’m okay with that solution as well but I think somewhere read that in Connect there is only a fine line between resolvers with side-effects and explicit mutations, so I assumed ::pc/input would work (to fetch from env/call resolve automatically) the same.

wilkerlucio01:04:34

@thenonameguy not really, but you can use mutation joins to request extra data, and you could write your own plugin that does that, I would suggest a different key (something like ::expose), if you add that key to your mutation it will stay there (the config is an open map, you can add anything you like)

wilkerlucio01:04:08

so in the plugin code, extending with ::p/wrap-mutate you can pull that and execuse (using a parser call)

kszabo01:04:49

yup, thanks!

kszabo01:04:53

since you are already here

kszabo01:04:37

have you considered how Pathom could make use of the nav and datafy protocols? REBL seems like the same graphy-domain-exploration-thingy that Pathom could be if it had larger reach

wilkerlucio02:04:18

@thenonameguy yes, it could use it to expand data, I didn't got the chance to play with that yet, but I imagine that you could the current auto-complete features to extract context, and probably suggest possible paths, so you could keep navigating

👍 4
kszabo12:04:59

hey @wilkerlucio, I tried to use Pathom Connect’s Index Explorer with transit+json encoding, and since the returned ::pc/indexes contain functions the encoding fails as by default transit doesn’t have a handler for fns. Would it make sense to update the example resolver code in the docs to remove these fns via postwalk?

kszabo12:04:17

I assume they won’t be used

kszabo13:04:23

(pc/defresolver viz-index-resolver [env _]
  {::pc/input  #{:com.wsscode.pathom.viz.index-explorer/id}
   ::pc/output [:com.wsscode.pathom.viz.index-explorer/index]}
  {:com.wsscode.pathom.viz.index-explorer/index (walk/postwalk #(when-not (fn? %) %) (get env ::pc/indexes))})

kszabo13:04:39

this way the Index Explorer works (and is AWESOME! 🎉 )

wilkerlucio15:04:13

@thenonameguy that's a concern outside pathom scope, for example, if you are using a local parser in CLJS, would be fine to send fns there (since there is no encoding needed), we may even inspect that fn, but I understand that its a common pitfall for users of the backend, a solution that I suggest is to setup transit default handlers, I think this is a good practice since after that nothing will break your encoding (and I believe that's what a lot of people would want)

kszabo16:04:11

sure, just a note would have been nice. As I think most people are going to use Fulcro with PC and I pulled some hairs out trying to figure out why it didn’t work. This is what I would need to patch: https://github.com/fulcrologic/fulcro/blob/develop/src/main/fulcro/websockets/transit_packer.cljc

kszabo16:04:12

and with the current setup I just got a network disconnect after 30 seconds, without any error response/logging server-side (which I know is a Fulcro WS wrapping issue but it was frustrating).

wilkerlucio18:04:11

@thenonameguy agreed better docs are needed since its a common pitfal