Skip to content

v0.7.1

Choose a tag to compare

@jaspertey jaspertey released this 30 Oct 07:19
b9264be

Upgrading

  • StartKitRequest moved from Tey\Kit\Features\SessionUi\Http\Middleware to Tey\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's withoutMiddleware) keeps working, but should switch to the new namespace. No stub changes, no re-pin.
  • Run kit:update plan|apply for core (re-pinned sha256:6537c1e1…3fa7 → sha256:909d632f…822e): Kit/Form/submitForm.ts and Kit/Form/formFrame.ts are new, and Kit/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.ts and Kit/index.ts change for useSubmitForm and the Workbench's :form (Added). Nothing changes for a page that doesn't use them: a Workbench without :form renders 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/Error page (or its own error page) when updateIfCurrent() refused a stale save from an Inertia visit now gets {"error":"stale_write"} with status 409, which Inertia hands to onHttpException. Handle it there (the Workbench's :form and useSubmitForm already 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): a fetch, useHttp or a socket, never an Inertia visit. It returns what FormActions reads from a useForm(), plus data, errors, submit(), setDefaults() and conflict. A SubmitError, a thrown fetch Response or useHttp error (422 Laravel errors to the fields, 409 stale_write to conflict, 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 (true or a list of fields), transform and warnOnLeave. A double submit is ignored.
  • FormCard with a useSubmitForm() is the <form> itself (novalidate): Enter and Save submit with no visit, a failure focuses the first invalid field, and the _form message shows above the bar. submit stays the action descriptor.
  • The Workbench's form frame, :form (docs/workbench.md › Form frame): an Inertia useForm() with save (the action descriptor it submits to), or a useSubmitForm(). 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. @submit replaces the kit's submit.
  • formFrame.ts: the form status and the leave-page guard, taken out of FormActions and 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. Only stale_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 to tests/fixtures/stale-write-409.json, the file the JS test feeds useSubmitForm.

Fixed

  • The kit's props survive a flush on a host without session-ui. The per-request start (StartKitRequest: the registry's startRequestUsing hooks, the request memo and access's memos, and KitShares::restore()) was session-ui's, so a core and shell host without it lost kitUi, kitToasts and shell after Inertia::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 to web and to the middleware priority list on every host that adopts core; session-ui keeps PrepareKitRequest (the late restore and the session-dependent brand switch) and no longer adds StartKitRequest, 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-order now counts StartKitRequest once in web and in the priority list with session-ui, under either name.
  • kit:status flags a request start that is off. Core joins StartKitRequest to web only when the app defines that group as core boots, so an app that defines web later, 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 a web StartKitRequest host step: met when web holds it (the deprecated session-ui name counts), else attention with the fix. test:status covers all three cases.
  • Enter in the Workbench's navigator filter no longer submits a form around it.

What's Changed

Full Changelog: v0.7.0...v0.7.1