fix: list cell now remembers the last ingredient selected

This commit is contained in:
Zhongheng Liu 2026-01-24 14:43:21 +01:00
commit 0da9490a60
Signed by: steven
GPG key ID: F69B980899C1C09D

View file

@ -135,7 +135,9 @@ public class IngredientListCell extends OrderedEditableListCell<RecipeIngredient
}
}
private HBox makeInputLine(RecipeIngredient ingredient, TextField amountInput, ChoiceBox<Unit> unitChoice) {
MenuButton ingredientSelect = new MenuButton(getLocaleString("app.prompt.select-ingredient"));
selectedIngredient.setValue(ingredient.getIngredient());
MenuButton ingredientSelect = new MenuButton(selectedIngredient.get() == null ?
getLocaleString("app.prompt.select-ingredient") : selectedIngredient.get().getName());
HBox container = new HBox(amountInput, unitChoice, ingredientSelect);
try {
makeMenuItems(ingredientSelect, server.getIngredients(), Ingredient::getName, i -> {