Sanity Library Reference Docs
    Preparing search index...

    Interface DefinedSanityLiveProps

    interface DefinedSanityLiveProps {
        intervalOnGoAway?: number | false;
        onError?: (error: unknown) => void;
        onGoAway?: (
            event: LiveEventGoAway,
            intervalOnGoAway: number | false,
        ) => void;
        refreshOnFocus?: boolean;
        refreshOnMount?: boolean;
        refreshOnReconnect?: boolean;
        requestTag?: string;
        revalidateSyncTags?: (tags: `s1:${string}`[]) => Promise<void | "refresh">;
        tag?: undefined;
    }
    Index

    Properties

    intervalOnGoAway?: number | false

    Automatically refresh on an interval when the Live Event API emits a goaway event, which indicates that the connection is rejected or closed. This typically happens if the connection limit is reached, or if the connection is idle for too long. To disable this long polling fallback behavior set intervalOnGoAway to false or 0. You can also use onGoAway to handle the goaway event in your own way, and read the reason why the event was emitted.

    30_000 30 seconds interval

    onError?: (error: unknown) => void

    Handle errors from the Live Events subscription. By default it's reported using console.error, you can override this prop to handle it in your own way.

    onGoAway?: (event: LiveEventGoAway, intervalOnGoAway: number | false) => void

    Handle the goaway event if the connection is rejected/closed. event.reason will be a string of why the event was emitted, for example 'connection limit reached'. When this happens the <SanityLive /> will fallback to long polling with a default interval of 30 seconds, providing your own onGoAway handler does not change this behavior. If you want to disable long polling set intervalOnGoAway to false or 0.

    refreshOnFocus?: boolean

    Automatically refresh when window gets focused Note that this is different from revalidation, which is based on tags and causes sanityFetch calls to be re-fetched.

    false if draftMode().isEnabled, otherwise true if not inside an iframe

    refreshOnMount?: boolean

    Automatic refresh of RSC when the component is mounted. Note that this is different from revalidation, which is based on tags and causes sanityFetch calls to be re-fetched.

    true

    refreshOnReconnect?: boolean

    Automatically refresh when the browser regains a network connection (via navigator.onLine) Note that this is different from revalidation, which is based on tags and causes sanityFetch calls to be re-fetched.

    true

    requestTag?: string

    This request tag is used to identify the request when viewing request logs from your Sanity Content Lake.

    'next-loader.live'
    
    revalidateSyncTags?: (tags: `s1:${string}`[]) => Promise<void | "refresh">

    Override how cache tags are invalidated, you need to pass a server action here. You can also pass a use client function here, and have router.refresh() be called if the promise resolves to 'refresh'.

    tag?: undefined

    use requestTag instead