Skip to content

0.8.0: a conflict on an Inertia visit is a validation-style error, not JSON - #668

Merged
jaspertey merged 4 commits into
mainfrom
feat/inertia-409
Nov 6, 2026
Merged

jaspertey merged 4 commits into
mainfrom
feat/inertia-409

Conversation

@jaspertey

Copy link
Copy Markdown
Member

Kit 0.8.0 (minor, breaking), approved by Jasper on 2026-11-06 ("Validation-style, kit 0.8.0").

What changes

  • On an Inertia visit, any registered refusal code that answers 409 (stale_write, stale_settings, deliver_stale, connection_* and the rest) now gets a redirect back with errors[<code>] set to the code's registered message. It goes in the visit's error bag, and X-Inertia-Error-Bag is respected.
    • Before: stale_write came back as raw JSON, which a plain useForm shows as Inertia's error modal.
    • Before: every other 409 code replaced the page with the error page, and the person lost their edits.
  • JSON requests (useHttp, fetch, the API) and MCP still get the 409 JSON. useSubmitForm, httpSubmit, row autosave and the Workbench layout and reorder endpoints are unchanged.
  • FormActions, FormCard and the Workbench now read the conflict from form.errors:
    • A conflict code blocks Save, with the reason "Reload to see the latest version before you save".
    • The status line shows the code's message.
    • The Workbench shows its conflict alert with the edits kept.
    • New helpers in formFrame: isConflictCode() and formConflict().
  • The Workbench's useForm save handles conflicts in onError, not onHttpException.

Proof

  • WorkspaceModelCheck, through the real kernel and exception handler:
    • A JSON save to the stale-write guard answers exactly tests/fixtures/stale-write-409.json.
    • Inertia visits refused with stale_write and with stale_settings get a 302 back to the Referer, with errors.<code> holding the registered message. There's no JSON and no error page.
    • A named error bag (X-Inertia-Error-Bag: ticket) is respected.
    • The record is unchanged.
    • The 404 refusals are still the error page.
  • Browser:
    • The Workbench :form (inertia) harness now answers a 409 as onError with errors.stale_write. Every Workbench :form test passes (12).
    • A new test: a visit refused with 409 blocks Save with the conflict reason, keeps the edits and ignores Ctrl+S. The count is now 155.
  • composer test:js 803/0, the component typecheck, Prettier, test:features, test:host-contract, test:phpstan-stubs and the CHANGELOG check all pass.

Upgrading (also in the CHANGELOG): code that caught the stale write on a visit in onHttpException moves to onError and reads errors.stale_write.

Kit #558 (self-hosted fonts) is not bundled with this release.

@jaspertey
jaspertey merged commit cf1d0e8 into main Nov 6, 2026
8 checks passed
@jaspertey
jaspertey deleted the feat/inertia-409 branch November 6, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant