Repository navigation
v0.7.1
Upgrading
StartKitRequestmoved fromTey\Kit\Features\SessionUi\Http\MiddlewaretoTey\Kit\Features\Core\Http\Middleware, and core now registers it (see Fixed). The old name is a deprecated alias of the new class, to be removed in a later release: a host that names it (a route'swithoutMiddleware) keeps working, but should switch to the new namespace. No stub changes, no re-pin.- Run
kit:update plan|applyforcore(re-pinnedsha256:6537c1e1…3fa7→sha256:909d632f…822e):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
- The kit's props survive a flush on a host without session-ui. The per-request start (
StartKitRequest: the registry'sstartRequestUsinghooks, the request memo and access's memos, andKitShares::restore()) was session-ui's, so a core and shell host without it lostkitUi,kitToastsandshellafterInertia::flushShared()(pest-plugin-browser's, before each request, or an Octane-style reset), and its own early middleware read around the request memo. Core now prepends it toweband to the middleware priority list on every host that adopts core; session-ui keepsPrepareKitRequest(the late restore and the session-dependent brand switch) and no longer addsStartKitRequest, so it is registered once. The host still wins: restore only fills keys Inertia's factory doesn't hold.composer test:core-request-start(new, in CI) runs a core and shell host through the real HTTP kernel;test:request-ordernow countsStartKitRequestonce inweband in the priority list with session-ui, under either name. kit:statusflags a request start that is off. Core joinsStartKitRequesttowebonly when the app defines that group as core boots, so an app that definesweblater, or not at all, quietly ran without request memos and lost the kit's Inertia props after a flush. With core adopted, status now carries aweb StartKitRequesthost step: met whenwebholds it (the deprecated session-ui name counts), else attention with the fix.test:statuscovers all three cases.- Enter in the Workbench's navigator filter no longer submits a form around it.
What's Changed
- Run the kit's request start from core, so hosts without session-ui keep their props by @jaspertey in #450
- useSubmitForm and the Workbench form frame by @jaspertey in #451
- Release v0.7.1 by @jaspertey in #454
Full Changelog: v0.7.0...v0.7.1