Luxar Viewer API Documentation - v2026.10.19
    Preparing search index...

    Module cache/root-document-prefetch

    One load-time fetch of a dataset's root metadata document, shared by every consumer that needs it.

    A cold load used to fetch the root document twice, back to back and strictly after renderer init: once for cache validation (bypassing the cache tiers) and again for the store open (through them). A CDN serving max-age answers the second from the HTTP cache; a no-store host pays twice — 6.5 MB for the h2afva scene. And nothing left the tab until the renderer had linked its shaders.

    This module fixes both. prefetchRootDocument starts the fetch the moment the ?src= URL is known (bootstrap, before app.init), in parallel with renderer init; the scene load then claims that in-flight response and hands it to BOTH readers through SharedRootDocumentSource:

    • Validation reads its token from it (probeIdentityToken). The fetch bypasses every Luxar cache tier exactly as validation always has, and the token is derived by the same validationTokenFromDocument, so content-hash semantics are unchanged. Validation keeps its fail-fast budget: it waits for the shared response at most timeoutMsOverride, then takes the TTL path as before while the fetch carries on for the store open.
    • The store open reads the same bytes as the source's answer for the root key, so they flow through the caching store's L1/L2 tiers like any fetched document (a later offline visit still finds them in OPFS).

    The response's ETag is kept too: the scene-identity watchdog seeds its first poll's If-None-Match with it (see SceneIdentityWatchdog.seedFromLoad).

    Sharing only applies to a plain directory store over http(s): a .zarr.zip keeps its root inside the archive, and a URL with a query string or fragment (a presigned source) needs the query-preserving URL building the stores do themselves — both fall through to the normal read path untouched.

    SharedRootDocumentSource
    RootDocumentFetch
    RootDocName
    RootDocOutcome
    isShareableRootUrl
    prefetchRootDocument
    claimRootDocument
    releaseRootDocument
    resetRootDocumentPrefetchForTests
    withSharedRootDocument