fix: keep previous settings (meal, persons, options) on regenerate

This commit is contained in:
dadaloop82
2026-04-04 15:35:07 +00:00
parent e233dcef6d
commit 57677fa0d0
4 changed files with 5 additions and 12 deletions
+3 -11
View File
@@ -7032,21 +7032,13 @@ function _renderMealPlanHint(mealSlot) {
function regenerateRecipe() {
_cachedRecipe = null;
const meal = getMealType();
// Use the meal the user currently has selected (not the auto-detected one)
const meal = getSelectedMealType();
// increment variation counter for this meal slot
_recipeVariationCount[meal] = (_recipeVariationCount[meal] || 0) + 1;
document.getElementById('recipe-result').style.display = 'none';
document.getElementById('recipe-loading').style.display = 'none';
// Rebuild meal selector with auto-detected default
const mealGrid = document.getElementById('recipe-meal-grid');
if (mealGrid) {
mealGrid.innerHTML = MEAL_TYPES.map(m => {
const checked = m.id === meal ? ' checked' : '';
return `<label class="recipe-meal-chip"><input type="radio" name="recipe-meal" value="${m.id}"${checked}> ${m.icon} ${m.label}</label>`;
}).join('');
}
updateRecipeMealTitle();
document.getElementById('recipe-persons').value = 1;
// Keep all existing form settings (persons, chips, meal) — just show the form again
document.getElementById('recipe-ask').style.display = '';
}