This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-25
Channels
- # aws (10)
- # babashka (4)
- # beginners (103)
- # calva (19)
- # chlorine-clover (2)
- # cider (10)
- # cljs-dev (23)
- # cljsrn (6)
- # clojure (145)
- # clojure-europe (17)
- # clojure-nl (1)
- # clojure-spec (11)
- # clojure-uk (4)
- # clojurescript (64)
- # conjure (11)
- # core-async (19)
- # cursive (38)
- # datomic (4)
- # duct (2)
- # fulcro (51)
- # helix (11)
- # joker (1)
- # kaocha (7)
- # leiningen (3)
- # malli (5)
- # meander (3)
- # off-topic (12)
- # pathom (17)
- # pedestal (2)
- # re-frame (27)
- # rum (11)
- # shadow-cljs (77)
- # xtdb (9)
- # yada (1)
com.fulcrologic.fulcro.data-fetch/load!
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 ?
You can create a separate component with whatever you'd like to load and pass that.
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.
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?
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?
Have another to-one reference entity that has all the other to-one cars, apart from the main to-one car. So :person/garage.
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.
I've always returned maps from remote transactions. Didn't even know it was possible to return a vector.
Can you not return a map?
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/id
enough 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
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?
That looks perhaps like transit-encoded empty value?
That really depends on how your ring handler is set up, not anything fulcro-specific.
Looks like that's set up for some kind of blob storage for urls starting with image/
.
That's possible. Based on your comment above it looks like you may be getting transit back.
Aghh, it is already configured to statically serve the contents of /resources/public... Seems like it doesn't do it for all file types
What is the purpose of com.fulcrologic.rad.attributes-options/target
when used for :ref
types ?
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.
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.