graphql

steveb8n 2019-03-18T06:27:43.036300Z

Q: I’m starting out with Lacinia-Pedestal. so far it’s been great. I have a question about resolver fns during development. I found that I can use fn indirection i.e. (util/attach-resolvers {:resolve-person #’get-person}) so that I can reload the get-person fn during development without a server restart. this is really nice

steveb8n 2019-03-18T06:29:18.037500Z

however, when I switch to using resolver factories https://lacinia.readthedocs.io/en/latest/resolve/attach.html#resolver-factories I lose the ability to have this indirection/reload capability. Does anyone have any tricks to make this work?

orestis 2019-03-18T09:20:23.037800Z

Can you not use #'literal-factory?

orestis 2019-03-18T09:21:18.038700Z

The trick here, AFAICT, is that vars are actually callable, so Lacinia doesn’t do anything particular in this case — just calling the thing you provide it.

steveb8n 2019-03-18T09:50:16.039200Z

sadly not. that references the factory, not the anon fn returned by the factory.

steveb8n 2019-03-18T09:51:05.040100Z

I figured out another solution. the factory can return (partial #’get-person …args…) as an anon fn and this supports hot reload

🙌 1
orestis 2019-03-18T09:51:57.040700Z

Ah, I guess something might be calling the factory early…

steveb8n 2019-03-18T09:53:22.041700Z

yep, I think that’s the design. it injects the data from the schema into the factory fn at compile time

steveb8n 2019-03-18T09:53:40.042200Z

that’s quite nice to make resolvers configurable via the schema edn

steveb8n 2019-03-18T09:54:37.042600Z

thanks for the suggestion though 🙂