Batching of Server-side Actions
Multiple queued actions are batched together into a group, and then sent to the server
in a single request (XHR) to minimize network round trips. The batching of actions is also known
as boxcar’ing, similar to a train that couples boxcars together.
All actions sent in the same boxcar are processed in one transaction. If you see an error for “uncommitted work pending”, it’s possible that a later action can’t be completed due to uncommitted work for an earlier action in the same transaction. For example, if the first action updates a record, an Apex callout in a second action can’t be completed due to the uncommitted work from the first action.
The server returns the XHR response to the client when all actions have been processed on the server. If a long-running action is in the boxcar, the XHR response is held until that long-running action completes.