Skip to content

Commit

Permalink
fix: Reset cached recipe when edit is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
SrGesus committed Jan 26, 2025
1 parent 1e69577 commit f10e133
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions frontend/components/Domain/Recipe/RecipePage/RecipePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export default defineComponent({
onUnmounted(async () => {
const isSame = JSON.stringify(props.recipe) === JSON.stringify(originalRecipe.value);
if (isEditMode.value && !isSame && props.recipe?.slug !== undefined) {
if (!isSame && props.recipe?.slug !== undefined) {
const save = window.confirm(
i18n.tc("general.unsaved-changes"),
);
Expand Down Expand Up @@ -274,7 +274,8 @@ export default defineComponent({
const { data } = await api.recipes.updateOne(props.recipe.slug, props.recipe);
setMode(PageMode.VIEW);
if (data?.slug) {
router.push(`/g/${groupSlug.value}/r/` + data.slug);
Object.assign(originalRecipe.value, props.recipe);
router.push(`/g/${groupSlug.value}/r/${data.slug}`);
}
}
Expand Down

0 comments on commit f10e133

Please sign in to comment.