Preparing search index...

    Interface UseRecipeIngredientsReturn

    Return value of the useRecipeIngredients hook.

    interface UseRecipeIngredientsReturn {
        editIngredients: (
            oldIngredientId: number,
            newIngredient: string,
        ) => void;
        addNewIngredient: () => void;
        addOrMergeIngredient: (ingredient: ingredientTableElement) => void;
        replaceAllMatchingFormIngredients: (
            validatedIngredient: ingredientTableElement,
        ) => void;
        removeIngredient: (index: number) => void;
    }
    Index

    Properties

    editIngredients: (oldIngredientId: number, newIngredient: string) => void

    Updates an existing ingredient at the specified index. If the ingredient name changes, triggers validation workflow for fuzzy matching. If only quantity/unit changes, updates the ingredient in place.

    addNewIngredient: () => void

    Adds an empty ingredient row to the recipe form

    addOrMergeIngredient: (ingredient: ingredientTableElement) => void

    Adds a validated ingredient to the recipe or merges its quantity if the same ingredient exists. If the ingredient exists with the same unit, quantities are summed. If units differ, the new ingredient replaces the existing one.

    replaceAllMatchingFormIngredients: (
        validatedIngredient: ingredientTableElement,
    ) => void

    Replaces ALL FormIngredients with matching name with the validated database ingredient. Preserves each ingredient's own quantity/unit/note while applying database metadata. Used by scraper validation when the same ingredient appears multiple times.

    removeIngredient: (index: number) => void

    Removes the ingredient at the given index from the recipe form