When a page renders and several parts of your UI eachDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/michael-tiger-2010/dragonjson/llms.txt
Use this file to discover all available pages before exploring further.
await a different path simultaneously, a naive client would fire one HTTP request per path — creating a waterfall of round trips that slows down the initial load. dragonJSON solves this by automatically collecting concurrent fetch requests into a single HTTP call and dispatching them together.
How batching works
WhenenableBatching: true (the default), every call to fetchPath pushes onto an internal batchQueue array and schedules a flush via setTimeout with a 100ms debounce window. When the timeout fires, flushBatch runs: it drains the queue, sends all accumulated paths in a single GET ?paths=[...] request, and resolves each individual promise with its corresponding slice of the response.
From your code’s perspective, you simply await paths as you normally would:
Server response format
The server must return a flat JSON object keyed by the exact path strings that were requested. Every path in the request array must appear in the response. If a path does not exist, returnnull for that key rather than omitting it — an absent key causes the client to reject that promise with an error.
processBatchData, which merges each path into rootData at the correct location so that subsequent accesses to those paths (or their children) resolve from cache.
$prefetch
$prefetch([...keys]) lets you pre-warm the cache for a set of sibling paths under a common parent. It resolves each parent.key path sequentially — awaiting each one before moving to the next — so the cache is populated for all of them before you start rendering.
Disabling batching
If you need predictable, per-request HTTP calls — for example, in a server-side rendering context where the debounce timer may not behave as expected — setenableBatching: false:
await sends its own GET ?path= request immediately.
Hierarchical batching
The advanced optionenableHierarchicalBatch: true extends the single-path fetch with two additional query parameters:
path— the node the client is actually fetchingtarget— the deep path the client is ultimately trying to reachhierarchical=true— tells the server this is a hierarchical batch request
__batch envelope containing multiple paths at once, allowing it to short-circuit several round trips by sending intermediate nodes alongside the final target:
path and ignore target. The client detects the absence of __batch and wraps the response itself. See Server Spec for full implementation details.
The batch debounce window is 100ms. Requests queued within the same event loop tick will almost always batch together.