Fork me on GitHub
murtaza5211:05:13!it takes a class or factory. My class has nested components, and I want to only load the top level component, how do I do that ? is there a way to just specify an eql query / ident, instead of a component ?

Chris O’Donnell11:05:37

You can create a separate component with whatever you'd like to load and pass that.

Chris O’Donnell11:05:54

Fulcro needs the component definition(s) to know how to normalize the results.


@codonnell thanks, I also found load-fields! , I assume that should also do the job.

Chris O’Donnell12:05:12

Didn't know about that, but it sounds promising!


Given nested components (datomic components defind through defattr :ref type)

{:person/name "a" 
 :person/cars [{:car/name "ab" 
                :car/insurance [{:insurance/name "cd"}]}] 
I am able to do such a pathom query
(parser {} [{[:person/id 1] [{:person/cars [{:car/insurance [:insurance/name]}]}]}])
However I am not able to do the following -
(parser {} [{[:person/id 1] [{:car/insurance [:insurance/name]}]}])
Shouldnt fulcro rad be able to generate a resolver for the above, or I am doing something wrong ?


You would need to create your own :person/id to :car/id resolver, if that path doesn't already exist from your RAD attributes. Does each person have a 'main' car?


how do I check the resolver path taken by a particular query ?


I just put debug statements in the resolvers. But there are better ways I believe.


But of course that doesn't help with auto-generated resolvers.


there is a trace also, couldnt get it to work though


Yeah setup with Pathom difficult in my experience. Maybe look at RAD code, template code..


So the person resolver the input is :person/id . As long as one of the outputs is :car/id , you should be right.


hmm tried the above, problem is there are multiple :car/id, so a single :person/id will resolve to a vector of :car/id, and this doesnt work. When I write a db func to just pull up one :car/id then it works


Yeah, that's why I talked about a 'main' car originally. Have to have one only. You can hide other cars under another entity perhaps?


did not understand, what you mean by hide them under another entity


Have another to-one reference entity that has all the other to-one cars, apart from the main to-one car. So :person/garage.


In fact for the main car consider having a simple person to car resolver.


wrote a resolver for person->cars


I have a question about returning values from remote transactions. Let’s say I have a server-side mutation resolver that returns a list of items, but I would also like to return tempid mappings… how do I do that? The data types clash (I cannot add temp-ids key to a vector.

Chris O’Donnell14:05:21

I've always returned maps from remote transactions. Didn't even know it was possible to return a vector.

Chris O’Donnell14:05:30

Can you not return a map?


well the value I’m loading is a list, but I can wrap it into a map

👍 4

in the rad-demo I see the seed data for the entities have both :db/id and an entity id ex :invoice/id, why do we need both ? Isnt just the :invoice/idenough for resolution ?


:db/id is the id for the Datomic datum, :invoice/id is the invoice id. If anything, you could do without :invoice/id


It is basically a slight abstraction from the database internals, since :db/id is technically an internal thing of Datomic


yes but datomic assigns :db/id if it is not specified, so is there a specific reason that fulcro is specifying it ? does fulcro-rad use the :db/id when it generates the resolvers ?


Assigning a temporary id to it allows you to add refs to specific datums without committing to the db first


Pretty sure fulcro-rad-datomic doesn't care about the :db/id as long as you don't define it as the primary index of an entity


@zilti thanks, that explains it.

👍 4

I have a question as well now. I placed an svg into resources/public/images. Trying to access it via the browser only returns ["^ "] though... I have never seen that before with Ring. Is there something Fulcro-specific going on here?

Jakub Holý (HolyJak)20:05:39

That looks perhaps like transit-encoded empty value?

Chris O’Donnell15:05:03

That really depends on how your ring handler is set up, not anything fulcro-specific.


I left it as-is from fulcro-rad-demo

Chris O’Donnell15:05:00

Looks like that's set up for some kind of blob storage for urls starting with image/.


That is commented out though


I guess it is a mime type issue

Chris O’Donnell15:05:38

That's possible. Based on your comment above it looks like you may be getting transit back.


Ahh it is being served as "transit+json" yes


Aghh, it is already configured to statically serve the contents of /resources/public... Seems like it doesn't do it for all file types


Yes, png works fine. svg fails


What is the purpose of com.fulcrologic.rad.attributes-options/targetwhen used for :reftypes ? I thought it was being used for generating resolvers, but that doesnt seem to be the case.


I've just been wondering... do I get any functional advantage (or lines-of-code advantage) from using Semantic UI React components over just using plain Semantic UI?


@zilti I do not use any Semantic UI React components unless they provide real logic (i.e. Dropdown). If I just want something like a grid or table, I just use the the CSS classes. It is less hassle, less overhead, etc.

Jakub Holý (HolyJak)20:05:45

Same here. I have used eg the Popup component because of its behavior.


if you want a LOC advantage, make your own functions or macros…i.e. we have a divs macro that takes a sequence of class kws, and results in nested divs:

(divs :a :b :c ...) => (div :a (div :b (div :c ...)))


@murtaza52 look through the source of both RAD the Datomic adapter, and RAD semantic UI. I don’t remember off the top of my head everywhere it is used, but it is important to know what kind of thing a ref points to in some situations.


If I want to see the pathom path taken to resolve a given eql query, how do I do that ?


Does fulcro-garden-css work with React Native?


(I'm technically using react-native-web but same API as far as I'm aware)