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
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?
Can you not use #'literal-factory
?
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.
sadly not. that references the factory, not the anon fn returned by the factory.
I figured out another solution. the factory can return (partial #’get-person …args…) as an anon fn and this supports hot reload
Ah, I guess something might be calling the factory early…
yep, I think that’s the design. it injects the data from the schema into the factory fn at compile time
that’s quite nice to make resolvers configurable via the schema edn
thanks for the suggestion though 🙂