This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-17
Channels
- # announcements (1)
- # asami (3)
- # babashka (10)
- # beginners (61)
- # calva (60)
- # clojure (47)
- # clojure-nl (3)
- # clojure-uk (10)
- # clojurescript (36)
- # conjure (18)
- # cursive (4)
- # datomic (25)
- # fulcro (21)
- # luminus (1)
- # malli (25)
- # off-topic (26)
- # pathom (2)
- # portal (55)
- # re-frame (1)
- # reagent (7)
- # sci (1)
- # shadow-cljs (25)
- # sim-testing (2)
- # sql (14)
- # vim (6)
- # xtdb (10)
man, Pathom union query is kicking my ass
So far i understood that the Fulcro syntax for union queries is invalid for Pathom, as queries should always be specified as a vector
I’m not at my computer, but I remember it as something like that. The whole query is a vector and the union portion involves a map as an item in that vector
Yeah, so I'm wondering about the correct approach:
in the union component: are we supposed to specify the query like this? :
(defsc CaseProgressUnion
[this props computed]
{:query (fn [] [{:nexus.case.image-annotation/id (comp/get-query ImageAnnotationCaseProgress)
;; ...more types here...
}])
I kind of made it work like this, but it took some hackery in the :ident
function, so I'm worried i'm missing the correct approach
I'm guessing that by wrapping the union in a vector, Fulcro normalization gets confused
Any pointers would be super appreciated :thumbsup::skin-tone-3:
df/load! with update-query
perhaps, I'll look into it further
What you’ve got looks right, excepting if you don’t have idents defined, that might cause issues
1. yes, but those examples illustrate the union query mechanism for the fulcro db only, not the situation where the pathom backend also has to parse the union query, which is (I guess) where the trouble starts as Fulcro and Pathom handle union queries slightly differently
2. yes hold on, i'll post what i have so far
{:query (fn []
;; Pathom idiomatic union query -> map wrapped in a vector
[{:nexus.case.image-annotation/id (comp/get-query ImageAnnotationCaseProgress)}]
)
:ident (fn []
(log/info "union props:" props)
(cond (contains? props :nexus.case.image-annotation/id)
(do
;(log/spy :info "CaseProgressUnion.ident-fn:" props)
(let [case-props (get props :nexus.case.image-annotation/id)]
;; HACK HACK HACK -> TODO -> why is this necessary??
(if (eql/ident? case-props)
case-props
(:nexus.case.image-annotation/id case-props))))))}
Hmm...that’s a bit outside my understanding of Fulcro at the moment. Hopefully someone else who knows more can help.
I’ll say that in my explorations of Fulcro, I’ve successfully used join queries with pathom, so I believe it is possible, and it was seamless.
Don't worry, chances are real that i've tied myself in a knot and that the problem isn't a fulcro one
thanks for "rubber ducking" 😉