enhancement
major
minor
major
minor
major
#29666
TL Views: leaving a frame by breadcrumb, Back, navigate-pop, show-object or logout discards a form's unsaved changes without asking
Problem
A page pushed into a <tile-stack> holds a <form> in edit mode with a changed field (dirty marker shown). Leaving the page by
- a click on a breadcrumb entry above it,
- a <navigate-pop> command ("Zurück"),
- the browser's Back button,
- a <show-object> (e.g. from the app bar's ticket search) - for another object the frame is replaced, for the same object the page leaves edit mode,
- a logout from the user menu
disposes the frame with no question: the change is gone, and reopening the object shows it in view mode with the stored value. Opening a dialog from the same page (<open-dialog>) does ask ("Ungespeicherte Änderungen … Abbrechen / Verwerfen / Speichern"), and so do <show-view> and an object navigation into a channel. Seen in the TL Development app, ticket page, snapshot build 42.
Expected
Every way of leaving a frame whose forms hold unsaved changes goes through the same dirty check as <open-dialog> and object navigation: the user may cancel (stay, keep the change), discard or save, and the navigation is carried out (or the browser history step is undone) accordingly.
Lösung
- Dirty check at the tile stack. Every frame of a <tile-stack> gets a dirty channel of its own (nested into the channel of the enclosing tab or sidebar item). The stack vetoes a change of its path that drops frames whose forms hold unsaved changes. Every way of leaving a frame writes that path, so breadcrumb, <navigate-pop>, <navigate-pop-to>, the browser's Back button (URL adoption) and <show-object> all end in the known question "Ungespeicherte Änderungen" and continue (or stay) according to the answer.
- <show-object> replaces the frames of the stack in a single path change (one question, no intermediate path), and a frame already showing the requested object stays in place.
- check-dirty for view commands. The option check-dirty of a view command (SELF / VIEW / NONE) is evaluated before the command runs: VIEW asks about the unsaved changes of the whole window, SELF about those of the scope the command sits in. The default is NONE (behavior of existing commands unchanged). To answer VIEW, the root context of a window carries a dirty channel which all nested scope channels report to.
- Logout (<logout-command>) checks with VIEW by default, so a logout from a page holding unsaved changes asks first.