Repository navigation
v0.5.99
Upgrading
- Run
kit:update plan|applyforcore(re-pinnedsha256:4ceba71a…78d7→sha256:df22fcbb…d4fa):Kit/Form/submitForm.tsandKit/Form/formFrame.tsare new, andKit/Form/FormActions.vue,Kit/Form/FormCard.vue,Kit/Workbench/Workbench.vue,Kit/Workbench/WorkbenchActions.vue,Kit/Workbench/WorkbenchNavigator.vue,Kit/Workbench/workbench.ts,Kit/contract.tsandKit/index.tschange foruseSubmitFormand the Workbench's:form(Added). Nothing changes for a page that doesn't use them: a Workbench without:formrenders as before. - A stale write on an Inertia request is now a JSON 409, not the error page (Changed). A host whose page or test expected the
Workspace/Errorpage (or its own error page) whenupdateIfCurrent()refused a stale save from an Inertia visit now gets{"error":"stale_write"}with status 409, which Inertia hands toonHttpException. Handle it there (the Workbench's:formanduseSubmitFormalready do), or update the test. Every other error code still renders the error page.
Added
useSubmitForm(initial, handler, options?), a form saved by the app's own handler (docs/submit-form.md): afetch,useHttpor a socket, never an Inertia visit. It returns whatFormActionsreads from auseForm(), plusdata,errors,submit(),setDefaults()andconflict. ASubmitError, a thrown fetchResponseoruseHttperror (422 Laravel errors to the fields, 409stale_writetoconflict, any other status a generic message) and a thrown Laravel 422 object are read in that order; anything else is the generic message. Messages are plain text capped at 300 characters. Options:timeout,resetOnSuccess(trueor a list of fields),transformandwarnOnLeave. A double submit is ignored.FormCardwith auseSubmitForm()is the<form>itself (novalidate): Enter and Save submit with no visit, a failure focuses the first invalid field, and the_formmessage shows above the bar.submitstays the action descriptor.- The Workbench's form frame,
:form(docs/workbench.md › Form frame): an InertiauseForm()withsave(the action descriptor it submits to), or auseSubmitForm(). One<form novalidate>around the grid, Save as the bar's primary submit (the app's actions go secondary), ⌘S / Ctrl+S, Saving… and Saved from the form, an errors summary that reveals and focuses the first invalid field, the conflict alert on a 409 with the edits kept, and the leave-page guard.@submitreplaces the kit's submit. formFrame.ts: the form status and the leave-page guard, taken out ofFormActionsand shared with the Workbench. A frame inside one that is guarding registers no second guard.
Changed
- A stale write answers JSON on an Inertia request. When kit's stale-write guard refuses a save (
RuntimeException('stale_write')), an Inertia request now gets the same JSON 409{"error":"stale_write"}as a JSON one, so the page keeps the person's edits and shows the conflict instead of being replaced by the error page. Onlystale_write: every other error code, and a 404, on an Inertia request still renders the error page. A PHP check sends a stale save through the real kernel and compares the body totests/fixtures/stale-write-409.json, the file the JS test feedsuseSubmitForm.
Fixed
- Enter in the Workbench's navigator filter no longer submits a form around it.
What's Changed
- Workbench form frame and useSubmitForm (0.5.x) by @jaspertey in #464
- Release v0.5.99 by @jaspertey in #467
Full Changelog: v0.5.98...v0.5.99