Skip to content

Function: validateCycleAndSelf()

validateCycleAndSelf<TRow>(sourceId, targetId, _position, state): MoveValidationResult

Defined in: src/tree-editor/validators.ts:35

Built-in move validator. Rejects self-moves and moves that would create a cycle (moving a node onto one of its own descendants).

  • sourceId is the node being moved.
  • targetId is the drop target (or null to move to root).
  • position is 'child' | 'before' | 'after' (informational here — the cycle/self checks apply regardless of position).

Type Parameters

TRow

TRow

Parameters

sourceId

string

targetId

string | null

_position

"child" | "before" | "after"

state

TreeState<TRow>

Returns

MoveValidationResult