Repository navigation
Upgrading
- Run
kit:update plan|applyforcore(re-pinnedsha256:5b4af9a6…b7df→sha256:b7a9b9ba…5e9d): this addsKit/Form/pendingWork.ts, andKit/Form/formFrame.ts,Kit/Form/FormActions.vue,Kit/Form/BulkDrop.vue,Kit/Workbench/Workbench.vueandKit/index.tstake the leave-guard changes below. A host with a hand-rolled Back/Forward or pending-upload guard beside a kit form frame can drop it, or keep it withwarnOnLeave: false.
Added
- Pending work counts as unsaved (docs/submit-form.md › Pending work).
usePendingWork()is the page's registry of work the form doesn't see yet:track(promise)holds it until it settles,begin()returns an idempotentend(), andpendingandcountare readable. While any is registered, the leave guard ofFormActions,FormCardand a Workbench with:formtreats the page as unsaved, even with a clean form. BulkDrop'sdirectuploads register themselves.createPendingWork()makes a separate registry. Both are exported from the kit barrel.tests/js/pending-work.test.mjscovers the registry.
Fixed
- The leave guard holds Back and Forward (docs/submit-form.md › Leaving the page). It caught only Inertia GET visits and closing the tab, so Back from a dirty form left it without asking. Where the browser has the Navigation API, a same-document traverse is now cancelled and asked about, and made again on Leave. Elsewhere the guard keeps one extra history entry for the page while it's unsaved, so Back lands on the page itself and asks; the entry is taken off when the page is clean, when a save starts and before a confirmed visit, so no duplicate entry is left behind. Stay keeps the page and its edits; Leave always goes.
- A save's own follow-up visit is no longer held. The guard let a visit through only in the same task as the form's submit event, so a
router.visit()inonSuccess, where Inertia'suseForm()is still dirty, asked "Leave this page?" after a successful save. The guard is now saving from the submit (orprocessingturning on) untilprocessingis off and every visit started meanwhile has finished. The browser job checks all of this on the real@inertiajs/vue3(leave.html): Back dirty and clean, with and withoutwindow.navigation, an upload in flight, and a save whoseonSuccessvisits another page.
What's Changed
- Leave guard: Back/Forward, pending work, and the save's follow-up by @jaspertey in #490
- Release v0.7.6 by @jaspertey in #492
Full Changelog: v0.7.5...v0.7.6