Hello! I struggle to integrate fully Pathom Viz with Fulcro app (using Pathom 3). I did what the code snippet at the end of https://blog.jakubholy.net/2023/pathom-viz-for-fulcro-pathom3/ shows but the problem is that Viz does not see my full environment. Namely the env-middleware is not applied to env at time of request.
Look at what Fulcro is doing here https://github.com/fulcrologic/fulcro-rad/blob/main/src/main/com/fulcrologic/rad/pathom3.clj#L119-L131:
1. At line 119, during setup time, the base env is wrapped with .viz.ws-connector.pathom3/connect-env
2. At runtime, i.e. for each request, the env-middleware is applied to the env at line 126
3. Finally it does runtime invocation of the process (= (p.eql/boundary-interface base-env)) passing it the middleware-modified env at L131.
So how can I get Viz working with the env middleware applied correctly? (The middleware does crucial work such as adding DB connection to the env). Thank you for any tips!
hello Jakub, when you connect with Pathom Viz, it connects that specific env, which is an immutable thing, in your code there, you are effectively making a new env with the extensions (of env-middleware and other things), the connection can't know about such changes
so you must push those definitions up, one way to delay some processing (in case you need some sort of input) is to make a plugin, that might do some processing in between requests
Thank you! That fixed it! And I updated the blog post to have the correct instructions.
Note: graphs in Pathom Viz show only the name, not namespace of resolvers. That plays badly with Fulcro RAD, which generated <entity type>/id-resolver for each entity => all show up just as “id-resolver” in the graph.