feat(forms): browser-level unsaved-changes guard for the Company form (MAPPS-292) #293
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
psa-systems/mokosh-apps!293
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/MAPPS-292-unsaved-changes-guard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a
use_unsaved_guard(dirty)hook insrc/hooks/unsaved_guard.rsthat installs abeforeunloadwindow listener while the supplied signal reads true. The Company form (~10 fields, the QA repro case) wires the hook to a deriveddirtymemo that compares every editable field to its initial value and suppresses the prompt during a save (the navigate-away triggered byis_submitting). Closing the tab, reloading, or navigating to an external URL on a half-filled Company form now surfaces the browser's "Leave site?" dialog instead of silently discarding the input.Scope. This hook covers OS-level navigation triggers. Dioxus 0.7's router does not expose a transition-guard API, so client-side
<Link>clicks andnavigator.push()still bypass the guard; that part of the unsaved-changes story is parked as a follow-up. The browser-level cover is the highest-impact half of the data-loss surface (the QA's specific complaint: ten fields lost on tab close). Other long forms (Contract, Project, Asset, Invoice) can opt in by wiring their owndirtymemo to the same hook in a follow-up.#MAPPS-292