Quick Q, can mutations get batched? So when I transact I can name multiple mutations in the transaction vector, am I guaranteed to only have those in a backend call? Or in other words, will network layer ever combine multiple transact calls into one backend call?
If you do [(f) (g) (h)] as a single transact! then the tx layer sends them as one transaction (thus the name). There is an exception: Since the response is a map keyed by mutation symbol, if you transact [(f) (f) (f)] it has to break them into three request/responses.
This is part of the reason why the transaction system is “pluggable”. I’ve tried to cover the general cases with good defaults that should work for most apps, but you might decide that some other kind of grouping/splitting makes more sense for your app.
The easy workaround is to make a new mutation that itself does your “batched thing”. The unit of composition in systems is the function, so you can always make a new one that wraps multiple…mutations are just the “semantic function” of full-stack Fulcro operation.
This question was mostly so I can be assured that when I fire off a transact, the result doesn’t include another mutation that was fired “concurrently” (if there is such a thing in js). So one transaction vectors of multiple transact calls are never combined?
correct, thus the vector form: they run sequentially in the abstract, and pathom runs them serially in the concrete unless you use an async parser. Fulcro defines the semantics, but cannot guarantee your server implementation
Awesome. I was mostly looking at it from the error handling perspective, i.e. if my statechart mutation goes to error action, it was from one of the mutations I requested, not something else.
correct