Preparing search index...

    Type Alias IngredientEditPatch

    IngredientEditPatch:
        | {
            kind: "replace";
            index: number;
            row: ingredientTableElement
            | FormIngredientElement;
        }
        | {
            kind: "merge";
            removeIndex: number;
            intoIndex: number;
            row: ingredientTableElement
            | FormIngredientElement;
        }
        | { kind: "remove"; index: number }
        | { kind: "append"; row: ingredientTableElement | FormIngredientElement }

    Structured patch emitted by editIngredients, replaceAllMatchingFormIngredients, and addOrMergeIngredient so the caller (the ingredient field-array hook) can apply the change via the RHF field-array API:

    • replace: fieldArray.update(index, row) — single-slot rewrite.
    • merge: fieldArray.update(intoIndex, row) + fieldArray.remove(removeIndex) — collapse a duplicate row into another.
    • remove: fieldArray.remove(index) — drop a row (dismissed from queue).
    • append: fieldArray.append(row) — add a new row at the end.

    Mass setValue('recipeIngredients', next) writes are gone: the caller touches only the slots that actually changed, so sibling rows retain object identity and do not re-render.