Sanity Library Reference Docs
    Preparing search index...

    Interface SanityInstance

    Represents a Sanity.io resource instance with its own configuration and lifecycle

    Instances form a hierarchy through parent/child relationships

    interface SanityInstance {
        config: SanityConfig;
        instanceId: string;
        createChild(config: SanityConfig): SanityInstance;
        dispose(): void;
        getParent(): SanityInstance | undefined;
        isDisposed(): boolean;
        match(targetConfig: Partial<SanityConfig>): SanityInstance | undefined;
        onDispose(cb: () => void): () => void;
    }
    Index

    Properties

    config: SanityConfig

    Resolved configuration for this instance

    Merges values from parent instances where appropriate

    instanceId: string

    Unique identifier for this instance

    Generated using crypto.randomUUID()

    Methods

    • Registers a callback to be invoked when the instance is disposed

      Parameters

      • cb: () => void

        Callback to execute on disposal

      Returns () => void

      Function to unsubscribe the callback