Fork me on GitHub
#pathom
<
2021-12-07
>
Jakub Holý (HolyJak)17:12:22

Is it possible to make a query like [{:some/entity [*]}] i.e. one that would fetch all attributes of an entity? Fulcro supports '* but Pathom does not, right? I.e. I must list the attributes I want?

👀 1
Jakub Holý (HolyJak)17:12:01

I forgot to mention I have P2, though an answer for P3 is also interesting

wilkerlucio17:12:17

its important to understand what * means for Pathom, and that is "give me all the data you loaded so far", which is different from "all possible data for this entity"

wilkerlucio17:12:57

so, for instance, a query like: [{[:ident/id 123] [*]}] will always return just {:ident/id 123}, because no resolver is triggered in this procress

wilkerlucio17:12:54

but something like [{[:customer/id 123] [:customer/name *]}] might return a map with many attributes, if this system has some customer-by-id resolver that returns 8 customer properties, all those 8 would get out as a consequence of *

wilkerlucio17:12:47

for a time there was a consideration to have another special one, like **, to get everything, but that never moved forward, and Im not convinced its a good idea at this moment, because the way Pathom works, its likely that in a lot of cases this might never finishes processing due to the amount of possibilities there

Jakub Holý (HolyJak)08:12:26

Thank you! I am not trying to express a need for it, I was just curious. Thank you!

tami514:12:09

Interesting, it makes sense to support such a thing for something like a details page of a post.

wilkerlucio14:12:35

@U02PHJ3C1QV that only works up to some point, for instance, a system will tend to expand, and even a blog post may have data you don't wanna fetch (like internal metrics), due to this is better to think about always expressing exactly what you need, and update the query in case you need to display more things, this will keep things predictable, otherwise you may accidentaly start fetching tons of unnecessary data

tami514:12:50

@U066U8JQJ oh that makes prefect sense. Thank you