@dxos/client
    Preparing search index...

    Variable changeConst

    change: <T extends Relation.Unknown>(
        relation: T,
        callback: ChangeCallback<T>,
    ) => void

    Perform mutations on an echo relation within a controlled context.

    All mutations within the callback are batched and trigger a single notification when the callback completes. Direct mutations outside of Relation.change will throw an error for echo relations.

    Type declaration

      • <T extends Relation.Unknown>(relation: T, callback: ChangeCallback<T>): void
      • Type Parameters

        Parameters

        • relation: T

          The echo relation to mutate. Use Obj.change for objects.

        • callback: ChangeCallback<T>

          The callback that performs mutations on the relation.

        Returns void

    const worksFor = Relation.make(EmployedBy, {
    [Relation.Source]: person,
    [Relation.Target]: company,
    role: 'Engineer',
    });

    // Mutate within Relation.change
    Relation.change(worksFor, (r) => {
    r.role = 'Senior Engineer';
    });

    Note: Only accepts relations. Use Obj.change for objects.