From 9247204f590a785abb40fbbcb8e5075b9a3b029b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Jan 2026 14:10:45 +0000 Subject: [PATCH] Fix data loss when saving recipe with duplicate name When a recipe save fails due to duplicate name, restore the original recipe data to prevent confusion and potential data loss when user navigates away. Co-authored-by: hay-kot <64056131+hay-kot@users.noreply.github.com> --- frontend/components/Domain/Recipe/RecipePage/RecipePage.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/components/Domain/Recipe/RecipePage/RecipePage.vue b/frontend/components/Domain/Recipe/RecipePage/RecipePage.vue index 68c567333..921316015 100644 --- a/frontend/components/Domain/Recipe/RecipePage/RecipePage.vue +++ b/frontend/components/Domain/Recipe/RecipePage/RecipePage.vue @@ -352,6 +352,10 @@ async function saveRecipe() { const { data, error } = await api.recipes.updateOne(recipe.value.slug, recipe.value); if (!error) { setMode(PageMode.VIEW); + } else { + // Restore original recipe data on error to prevent data loss + restoreOriginalRecipe(); + return; } if (data?.slug) { router.push(`/g/${groupSlug.value}/r/` + data.slug);