This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-23
Channels
- # babashka (22)
- # beginners (8)
- # calva (7)
- # clj-kondo (65)
- # cljdoc (9)
- # cljsrn (1)
- # clojure (53)
- # clojure-australia (4)
- # clojure-europe (49)
- # clojure-gamedev (2)
- # clojure-italy (13)
- # clojure-nl (1)
- # clojure-spec (19)
- # clojure-uk (4)
- # clojurescript (48)
- # clojureverse-ops (1)
- # core-async (3)
- # css (2)
- # cursive (15)
- # datomic (6)
- # degree9 (2)
- # depstar (4)
- # emacs (2)
- # find-my-lib (1)
- # fulcro (16)
- # graalvm (11)
- # gratitude (1)
- # honeysql (9)
- # introduce-yourself (2)
- # jobs (1)
- # joker (2)
- # livestream (2)
- # malli (16)
- # nbb (4)
- # news-and-articles (2)
- # off-topic (1)
- # pathom (7)
- # polylith (10)
- # practicalli (1)
- # re-frame (7)
- # reitit (1)
- # releases (3)
- # remote-jobs (1)
- # rewrite-clj (19)
- # shadow-cljs (10)
- # tools-build (1)
- # tools-deps (9)
- # uncomplicate (1)
- # vim (3)
- # xtdb (44)
Not sure if this is a fulcro or pathom thing. I am going through the exercises by @holyjak and am now integrating the Pathom. In the EQL browser it seems like the autocomplete works only half way, even after loading the indices, and even when the query works. More concretely
[{[:player/id 1]
[{:player/address [:address/city]}]}]
works, but the autocompletion in the innermost part (the city) autocompletes on a global scope (so to the pathom internal stuff and the :teamsThe problem is that Pathom does not know what :player/address
is, it is opaque to it. It has been only told that it exists but that what the value is, i.e. that the value has :address/id
etc. Let me see at how to fix it.
So the solution is to update defresolver player
- ::pc/output
by replacing :player/address
with {:player/address [:address/id]}
. Thus Pathom knows that it can get from :player/address
to :address/id
and thus also to :address/city
.
https://github.com/fulcro-community/fulcro-exercises/commit/069f7370f6da0bfa0b3716c4381fde674744e291
Though perhaps surprising that queries still work, with disconnections in the schema graph
For the sake of the tutorial/exercise, would it make sense to have that connection already in the my-very-awesome-teams?
Queries work because they look at the data, not about what the resolver declares it returns.
https://github.com/fulcro-community/fulcro-exercises/commit/81af8f190197084f867f252a1dc34424ddb859be
I think that it's perhaps an untrivial thing to realize, that is, it might be a step too far to leave it only in the solution, while the original template for the exercise has a disconnected graph. At least if there isn't a pointer that there's a bug, and the reader should look at the my-very-awesome-team resolver options to fix the autocomplete
Then again, I guess so far I was the only one who noticed and didn't know what was happening 🙂
good catch, I should have thought of that 🙂
In https://book.fulcrologic.com/#_parsing_queries, there is an example of a resolver:
;; Given a :list/id, this can generate a list label and the people
;; in that list (but just with their IDs)
(pc/defresolver list-resolver [env {:list/keys [id]}]
{::pc/input #{:list/id}
::pc/output [:list/label {:list/people [:person/id]}]}
(when-let [list (get list-table id)]
(assoc list
:list/people (mapv (fn [id] {:person/id id}) (:list/people list)))))
Why does this resolver assoc in a vector of person ids using map forms like (`{:person/id id}`) instead of assoc'ing in a vector of idents?
The way I think about it, idents should be used like a foreign key - just a pointer to more complete record elsewhere. But I notice that that ident-like maps are often used instead. Can anyone please explain?Idents are used in the frontend ie Fulcro. The backend - Pathom - works with maps.
Remember, Pathom returns a denormalized tree of data. F introduces idents to normalize it.