-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Prevent leaving the editor if there are unsaved changes #23170
Prevent leaving the editor if there are unsaved changes #23170
Conversation
There's a similar PR here: #20161 |
I like it! Nice work! |
ec49f08
to
59bb2e9
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.
Tested, works pretty solid.
There are a few cases that are not handled by this solution, as it only works for anchor links. Like if you open the more info in the automation editor and then go to the device from the overflow your will still navigate away while losing your changes. I wonder if we can go 1 step deeper and intercept the |
eb888e5
to
3436a02
Compare
Actually looks like this is not really an issue atm, as an automation is not part of a device and the other related items and history and logbook do use anchors... |
2 options I could think of (not easy ones :D)
Neither one of the solutions allows to access the component to ask if it's dirty, so it will need to be a static piece of memory somewhere. |
Proposed change
Prevent (accidentally) exiting the automation/script/scene editor by navigating in the sidebar if you have unsaved changes. You will now be asked if you are sure you want to leave the editor.
WTH: https://community.home-assistant.io/t/wth-doesnt-ha-ask-if-i-want-to-save-automations/804030
Bildschirmaufnahme.2024-12-05.um.19.50.50.mov
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: