Sanity Library Reference Docs
    Preparing search index...

    Interface NodeDiffProps<Annotation, Value>

    Props that encapsulate changes in the node's value.

    interface NodeDiffProps<Annotation, Value = unknown> {
        __unstable_computeDiff: ComputeDiff<Annotation>;
        changed: boolean;
        compareValue?: Value;
        hasUpstreamVersion: boolean;
    }

    Type Parameters

    • Annotation
    • Value = unknown

    Hierarchy (View Summary)

    Index

    Properties

    __unstable_computeDiff: ComputeDiff<Annotation>

    A function that takes any value and produces a diff between that value and the value the node is being compared to.

    This can be used to compute a diff optimistically.

    This is marked as unstable because the API may need to evolve as we iterate on the advanced version control functionality. It will be stabilised when that project has matured.

    changed: boolean

    Whether the current value is different to the value the node is being compared to.

    compareValue?: Value

    The value the node is currently being compared to. This is taken from the upstream version, if the document has an upstream version. Otherwise, it's taken from the document's current value.

    You can use the hasUpstreamVersion prop to determine whether the document has an upstream version.

    hasUpstreamVersion: boolean

    Whether the document has an upstream version.