Is it possible to have a subform without an ident? I noticed the fulcro book subforms have some db/id. In my case, I have an address component in my schema for an entity.
how would an address be related to a parent if it doesn’t have an ID? Of course it needs an id and ident.
you CAN use a native ID (you don’t have to add a UUID, if that’s what you mean)
but in RAD you alias the :db/id to :address/id so that it understands which kind of entity to expect (resolver-wise)
This is an example data structure I fed into my form. I have a form config join in the Person form component with a join on the Address form component. Unfortunately, there's no ident for the address.
{:person/primary-address [:address/country-code
:address/line1
:address/line2
:address/locality
:address/subdivision-code
:address/postal-code]}
you will need an :address/id, which you can map to :db/id (in Datomic) or native row ID in SQL, etc. And it will need an ident, as I said. How can you make a join in a db without an iD? Unless you mean you want it to be fields in the parent entity/row (to-one) without an actual ref relationship. Then that is possible, but you’d then need the parent ID to appear in the child (with the parent’s ident even) so that things would get normalized properly. In other words it is allowed for a child UI component to share the “data space” of the parent.
Good morning! I have a question about the queues behind comp/transact! and df/load.
I currently have a RAD report that renders a bunch of rows. I have an “Analyze All” button, that for each row, triggers a sequence of transactions with {:parallel? true} that makes calls to an LLM that can take tens of seconds to run.
While the transactions run, I go to the next page, and all my component df/loads {:parallel true} get queued up behind the LLM transactions, which basically makes my app unusable until all the LLM operations finish.
How do I get these df/loads to take priority over the comp/transact? I’ve tried the df/load with and without {:parallel?}
Thank you! (I saw the discussion here, which seemed relevant, but couldn’t quite grok where it all ended up. https://clojurians.slack.com/archives/C68M60S4F/p1616460727115900?thread_ts=1616458487.111800&cid=C68M60S4F)
What you are more likely running into is the the browser itself limits parallel requests
You’ve switched from using Fulcro’s queues, and are instead hitting the hard limit of the browser itself.
The answer is to write a single read that can somehow get your rows as a single request, so they don’t clog the queue… same with the transactions. Parallel takes them OUT of Fulcro’s control. Submit a single transact with the multiple calls as a SINGLE call to transact, which will result in a SINGLE network call.
this will mean a lot more work on your part. You could also try the read-combining transaction processing (which can be plugged in). That support tries to combine multiple loads into a single network request, but depending on how it gets invoked it may fail to help.
You’re doing a case that goes beyond the basics of what Fulcro can do with the pre-canned facilities. As soon as you start doing large numbers of parallel reads/writes you’re going to run into problems because of this browser limitation.
That said, you can also use the low level load-mutation to send custom batched loads…and as I said you can submit many mutation calls with a single transact. Moving these things down to single requests will get you past the browser limitations.
That is so helpful — thank you! I’ll ponder the potential solutions and will post what I come up with. HAGW!
Do I understand correctly that websockets might be a way to send data asynchronously from server back to client, to send client database updates?
yes, that is what they are good at
I use websockets for llm based requests (and actually anything that takes more than a second)
It can be the browser but it can also be the backend, for most webservers if you have more concurrent requests than threads it will queue up. So if all your threads are clogged with slow llm requests your backend becomes completely irresponsive
Thats why some support async requests/reponses or use the new light threads to remove that limitation
(eg latest http-kit)
For sure if you’re doing back-end parallel work where it isn’t CPU bound you should try to use async mechanisms. Beware light threads: if they get CPU bound they don’t work the way you think they will. They won’t context switch correctly (they rely on blocking calls for interruption). The async support, however, works very well in http kit for large parallel loads where I/O tends to cause unnecessary server clogging.