Fork me on GitHub
Björn Ebbinghaus14:11:05

Is there a recommended way to "merge" queries? Imagine two components A, with attributes a1, a2, and A-details, with attributes a1, a3 I would like to load a1-3 at the same time. Is the correct way to write a meta component A-full with a merged query? {:query #(into [] cat [(comp/get-query A) (comp/get-query A-details)])


you have to actually do joins on each subcomponent…make up edge names


extracting them will lose the metadata structure that is important for UI refresh


but you’ve been around for a while, so I don’t imagine this is really a Fulcro 101 question? If those two components are just server queries that you truly are goign to render in a parent (without using the subcomponents at all) then it could be ok the way you wrote it


or, if you’re just making a query component for server interactions that’s ok, but you still lose component identity, which is significant only in the render and data merge story.

Björn Ebbinghaus15:11:16

In this case it is just for the server load. But I often struggle when it comes to composition. I build a large detail view and have to compose it into something where I need additional attributes that belong to the logical entity, but not to the UI. This often leaves me in a situation where my query would look like this:

 :details {:name

{:list-entry {:name :profile-picture}
 :details {:name :location}}
It would feel odd to query like this from the server, where the structure is flat.


@tony.kay Hi Tony. First thank you again for the tons of work! I would not know where to start with these things without the path you provide! I just implemented my first Union Query by following the book example 11 "Union to Select Type". The example defines

(defn person? [props] (contains? props :person/id))
and builds item-ident on it. This bit me with data that gets merged from the server, because
(:person/id props)
will not return nil while normalizing but :com.fulcrologic.fulcro.algorithms.merge/not-found. I solved it by replacing it with uuid? which will not work for others. Please put a warning in the text for the next guy. And thank you again for providing fulcro, the book and the videos. I worked through all of them at least once, some 3 times. They really help!!


@mroerni Pathom provides the "placeholder nodes" as a solution to this, this problem dates back to

👌 4
Björn Ebbinghaus19:11:18

@wilkerlucio This looks great! It will prevent a lot of headaches. Maybe they will even help me keeping the UI and DB structure apart.


yup, started as a workaround, but after years using it I consider that a very nice feature, allowing the client to add extra structure to the output as needed


now I consider that an important feature of pathom 🙂

Björn Ebbinghaus20:11:57

Do you think this should be a Fulcro feature?


no, I think it makes more sense as a feature for the server processing, Fulcro works with it out of the box, in the fulcro sense there is no difference (the placeholders will end up being idents that point to the same resource, so normalization works just fine)

Björn Ebbinghaus21:11:35

This makes sense when Fulcro queries are best kept to UI and should not care about the structure in the backend.