-
-
Notifications
You must be signed in to change notification settings - Fork 849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Prompt to save when there are unsaved changes #4945
base: mealie-next
Are you sure you want to change the base?
fix: Prompt to save when there are unsaved changes #4945
Conversation
0524a1b
to
fb8e020
Compare
6f5d147
to
9d463fd
Compare
Fixed the linting warnings |
5fc1c25
to
9d463fd
Compare
9d463fd
to
55ff8dd
Compare
55ff8dd
to
269706f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for your contribution, and sorry for me being a bit late to the party. Vacation got in the way.
There are still a few things that need updating around this PR.
When a user is leaving the page recipe edit page (e.g. by clicking the mealie icon top left) and changes were made we have an alert poping up. We should replace the alert with your implementation for consistency and a nicer experience.
:timeout="0" | ||
top | ||
> | ||
{{ snackbarText }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of returning the string from script you can just use this:
{{ snackbarText }} | |
{{ $tc("general.unsaved-changes") }} |
@@ -1,5 +1,20 @@ | |||
<template> | |||
<div> | |||
<v-snackbar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had looked into that but would have to change how the toasts works to make it behave the way this snackbar is.
That pop up previously only appeared when you were in edit mode and prevents you from leaving the page, I did change it to also appear when you have unsaved changes outside of edit mode. (and the snackbar only appears when outside of edit mode to warn the user + gives him the option to easily discard without having to enter edit mode again which i think is a plus) |
Yeah, your argumentation towards the first point makes sense, i would still prefer this to be its own component so this can be reused somewhere else if needed and is not hidden away somewhere within the recipe page. Towards the seccond point. I want to get rid of the alert style window confirms and replace them with the snackbar you implemented here to have a coherent user experience. |
What this PR does / why we need it:
When you are editing a recipe in RecipePage and close the edit mode, there are now unsaved changes but one is not prompted to save those changes.
The discussion on issue #2268 settled on prompting for saving when the
close
is clicked, but i think it would make more sense to prompt for unsaved changes on exit, where they are already being prompted (but were previously only if edit mode was on).So to achieve this the only changes that need to be done are removing the condition of being in editing mode to be prompted for unsaved changes, and to fix an issue regarding the saving not updating the
originalRecipe
that should be updated whenever the recipe is saved.Also adding a snackbar when not in edit mode where you can choose to discard the changes, and the original recipe will be displayed.
Which issue(s) this PR fixes:
Fixes #2268