From e0196f17da676329ef557c48507529cf173371b3 Mon Sep 17 00:00:00 2001 From: orycterope Date: Tue, 18 Nov 2025 14:10:52 +0100 Subject: [PATCH] open meal plan recipe with given servings Fix https://github.com/TandoorRecipes/recipes/issues/3787 Adds a '?servings=42' query param to RecipeViewPage, and propagates it to child views via a prop. The ingredientFactor is computed based on this param if it is present, and defaults to recipe servings otherwise. This query param is set when comming from: * Home page's HorizontalRecipeWindow * MealPlanEditor This commit also makes the RecipeView's Activity form reactive on the number of servings, before creating a comment. --- .../display/HorizontalMealPlanWindow.vue | 6 +++++- .../src/components/display/RecipeActivity.vue | 15 +++++++++++-- vue3/src/components/display/RecipeCard.vue | 21 +++++++++++++------ vue3/src/components/display/RecipeView.vue | 19 ++++++++++------- .../model_editors/MealPlanEditor.vue | 2 +- vue3/src/pages/RecipeViewPage.vue | 9 +++++++- 6 files changed, 54 insertions(+), 18 deletions(-) diff --git a/vue3/src/components/display/HorizontalMealPlanWindow.vue b/vue3/src/components/display/HorizontalMealPlanWindow.vue index 4b1ee0db7..ac38011c6 100644 --- a/vue3/src/components/display/HorizontalMealPlanWindow.vue +++ b/vue3/src/components/display/HorizontalMealPlanWindow.vue @@ -146,7 +146,11 @@ onMounted(() => { function clickMealPlan(plan: MealPlan) { if (plan.recipe) { - router.push({name: 'RecipeViewPage', params: {id: plan.recipe.id}}) + router.push({ + name: 'RecipeViewPage', + params: { id: String(plan.recipe.id) }, // keep id in params + query: { servings: String(plan.servings ?? '') } // pass servings as query + }) } } diff --git a/vue3/src/components/display/RecipeActivity.vue b/vue3/src/components/display/RecipeActivity.vue index abc6e7179..f5746c1e6 100644 --- a/vue3/src/components/display/RecipeActivity.vue +++ b/vue3/src/components/display/RecipeActivity.vue @@ -69,7 +69,7 @@