This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-11
Channels
- # announcements (3)
- # babashka (62)
- # beginners (58)
- # calva (40)
- # cider (3)
- # clj-kondo (75)
- # cljdoc (14)
- # clojars (8)
- # clojure (110)
- # clojure-australia (6)
- # clojure-europe (38)
- # clojure-hungary (1)
- # clojure-india (4)
- # clojure-italy (1)
- # clojure-nl (3)
- # clojure-spec (4)
- # clojure-uk (3)
- # clojurescript (45)
- # conjure (4)
- # cursive (35)
- # data-science (1)
- # datomic (11)
- # events (2)
- # exercism (4)
- # figwheel-main (4)
- # fulcro (103)
- # graphql (16)
- # helix (1)
- # holy-lambda (16)
- # honeysql (1)
- # introduce-yourself (3)
- # jobs (1)
- # keyboards (2)
- # lsp (4)
- # malli (11)
- # membrane-term (3)
- # mount (2)
- # nextjournal (2)
- # off-topic (53)
- # pathom (30)
- # pedestal (2)
- # portal (22)
- # rdf (1)
- # re-frame (7)
- # reagent (3)
- # reitit (5)
- # remote-jobs (6)
- # shadow-cljs (20)
- # sql (8)
- # tools-build (10)
- # vim (4)
- # xtdb (12)
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?
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 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
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:
https://github.com/wilkerlucio/pathom-viz/blob/de5fcb8f6ddc0acfbc834cf0c811d1de36fa39d2/src/core/com/wsscode/pathom/viz/helpers.cljs#L346
(-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 https://github.com/fulcrologic/fulcro-rad-demo/blob/a55b33ae82f372c26ee51b67c6c9b74a07a2cbeb/src/xtdb/com/example/components/parser.clj#L48. 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}],
:children
[...
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
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
https://blog.wsscode.com/pathom/v2/pathom/2.2.0/core/trace.htmlThanks @wilkerlucio.