Sanity Library Reference Docs
    Preparing search index...
    • Fan N per-resource guard streams into one useSyncExternalStore source: one subscribe across every resource, and a merged array snapshot rebuilt only when a resource emits. An instance's guards co-locate with the subjects they lock, so they're spread across the resources the instance's GDRs name (the engine's own dataset plus each subject dataset); each adapter supplies the store-specific per-resource DocStore (App SDK getQueryState, Studio listenQuery), while the shared observer layer owns fan-out and snapshots.

      loading while a resource is pending unless another reports invalid or error — a partial merge never renders as the full guard list. Once every resource is ready: dedups by _id (the same guard never appears under two resources, but a defensive merge keeps the snapshot well-formed) and sorts by _id for a stable order; a resolved-empty merge is the shared NO_GUARDS value identity so downstream session effects do not re-feed equivalent empty lists.

      Parameters

      Returns DocStore<readonly MutationGuardDoc[]>