Fork me on GitHub

Hi, just checking if I can somehow make this modeling work. I have multiple resolvers for the same attributes, and they are prioritized and working. The problem is that some resolvers return more attributes than others. For example, resolver outputs :a, and resolver B outputs :a and :b, and have less priority.


Now for the problem - I want resolver A to somehow signal "I found :a, and :b doesn't make sense in this context, so don't try to resolve this attribute" Currently I'm returning nil, but I really don't like to use nil in my code - is there a better way?


how do you determine that an attr doesn’t make sense in a given context?


That's what I want to know how to do it in Pathom 😄. But if you're asking like "more conceptually, in your code", it's because I'm trying to make a bunch of resolvers to drive Clojure plug-ins. In my specific case, I'm implementing "go to var definition" and friends. So, for example, if I want to "go to var defintion" for a var, and I find that the file is inside a JAR, it makes sense to get the contents of the file, uncompressed. But something things conflict: for example, if I find a file that is already on the current filesystem, and don't return its contents, the resolvers will keep trying to find a resolver that may get the contents, and sometimes this translates to "doing the wrong thing"


got the point, actually i think we have a similar problem 🙂 something we were going to try was a to create a plugin where you register the optional outputs of a given resolver. something like:

(defresolver a-resolver []
  {::pco/optional [:b :c]}
and the plugin basically would add the nulls if not present. i am not a big fan either of this so it would be great to hear a different solution 🙂


What is the difference between eql/focus-subquery and eql/mask-query ?! There is some (historical) reason to have these two?


i'm interested in this too


I took a look at the code, they really seem the same, my guess is that at some point I wanted the mask and couldn't find the focus-subquery and ended up remaking it... but by looking at the sources you should prefer focus-subquery, the implementation is more complete, and supports unions


I wanna look closer to make sure this is the case, if so I'll deprecate mask-subquery

👍 1

They behave a bit differently in some edge cases

((juxt (partial apply eql/mask-query)
   (partial apply eql/focus-subquery))
 [[:a {:b [:c]}]
  [:a {:b []}]])
=> [[:a {:b [:c]}] [:a {:b []}]]


@wilkerlucio I'm studying your pathom-viz codebase and I think you've got a typo: (-swap! [a f x y more] ,,,) should be (-swap! [a f x y & more] ,,,) - right?


If so, FulcroComponentProp and ReactAtomState have the same bug. Unless I misunderstood the code.


I believe this is correct though, its a protocol related thing, I remember going over this in the past, but would be nice to validate it, if you look at the ISwap protocol, you will see this:


(defprotocol ISwap
  "Protocol for adding swapping functionality."
  (-swap! [o f] [o f a] [o f a b] [o f a b xs]
    "Swaps the value of o to be (apply f current-value-of-atom args)."))


You're right, the protocol is correct and I confused swap! with -swap!. Sorry for the false alarm :)


I'm a little confused about how to use p/trace-plugin with Fulcro RAD. I've added p/trace-plugin as part of the extra-plugins vector here Then what? Where can I see the trace results?


Ah, I see now, the response contains some new information:

{:start 1,
  :path [],
  :duration 14,
  :details [{:event "trace-done", :duration 0, :start 15}],


Any tips on how to get a visualization working? I see trace->viz but haven't yet figured out how to get that to work from my trace output.


this is intended to use with Fulcro Inspect or Pathom Viz, these tools have code to render this trace data


Alright, so I use Inspect. Where in there can I find the tracer stuff? Sorry, I must be missing something really obvious..


maybe not so obvious, but can you try running a query from fulcro inspect query tab? ensure the checkbox for “Request Trace” is on


to get the trace you need to add :pathom/trace to the query, this is what the checkbox there does


what people usually do is some server config to always add that in dev mode


I do not see "Request Trace". You mean in the EQL tab, yeah?


It looks like I have latest installed too, 3.0.5.


Ah, under Network at the very bottom. I see the profiler there now. But I still don't see Request Trace anywhere.


I notice the profiler doesn't show up at the bottom for all requests in the Network tab. For example, if I create a request through my UI, that doesn't have the profiler timeline at the bottom. If I then press Send to query and re-issue the request from the EQL tab, the new log entry in Network does have the profiler timeline at the bottom. I guess this might be why I missed it before. I still don't see the checkbox you speak of though.


this is the server configuration part I talked about, for tracing data to be available you need to add :com.wsscode.pathom/trace to the query, a simple way to do that is to wrap your parser in another fn like:

(defn traced-parser [tx]
  (parser (conj tx :com.wsscode.pathom/trace))
But you can make this query modification in any layer that makes sense in your system, could be also from the UI for example, modifying the network request from the Fulcro remote