ui: useUnsavedChanges does not guard param-only route changes #91
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Follow-up to #51 (PR #90).
useUnsavedChanges(packages/ui/composables/useUnsavedChanges.ts) registersonBeforeRouteLeave, which only fires when the route record changes. A param-only navigation on the same record, for example editing/pages/1/editin the address bar to/pages/2/edit, stays on the record: the guard never asks, the form'sload()runs and silently replaces a dirty model. Query changes such as a company view's?tab=are not affected, since they are not leaves either and do not reload the model.No in-app link does this today, so it is an edge case rather than a regression.
Proposal: the composable also registers
onBeforeRouteUpdate(() => confirmLeave()), so a param change asks the same question through the sameAlertDialog. Document it in the composable's JSDoc and the RecordForm AUDIT.