feat(record-form): dirty tracking and an unsaved-changes guard #90
Loading…
Reference in a new issue
No description provided.
Delete branch "issue/51-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?
RecordForm now owns dirty tracking. A new
baselineprop is the last saved state (the firstmodelValueseen at setup when omitted);dirtyis a structural comparison ofmodelValueagainst it (isEqualRecordinutils/cms), alwaysfalseinreadonlymode, emitted asupdate:dirtyforv-model:dirtyand exposed on the instance.useUnsavedChanges(dirty)(@pienter/ui/composables/useUnsavedChanges) turns that flag into a leave guard:beforeunloadwhile dirty, a vue-routeronBeforeRouteLeaveguard registered inside the composable, and{ pending, confirmLeave, resolve }for a consumer-renderedAlertDialog.The five playground forms (Page, Blog, Settings, Company, Contact) keep a
baselineref refreshed after load and after a successful save, bind:baselineandv-model:dirty, and render one destructive "Discard unsaved changes?"AlertDialogbound topending/resolve.Closes #51
af741fd9b71f7a064e2c