dox_inertia 3.0.0-alpha.3
dox_inertia: ^3.0.0-alpha.3 copied to clipboard
Inertia.js for the Dox framework: build single page apps with React, Vue or Svelte and Dox controllers, with no API to write.
3.0.0-alpha.3 #
- Needs
dox_core3.0.0-alpha.11 (sessions and CSRF). - Breaking:
InertiaMiddlewareis now anIDoxNextMiddleware. It runs code after the controller too. It is not abstract any more: useconst InertiaMiddleware()when you have no props to share. InertiaMiddlewareturns a302into303after an InertiaPUT,PATCHorDELETE. So the browser follows the redirect withGET.- Breaking:
Inertia.redirectis removed. Useredirect(url)orback(req)from Dox. - With
SessionMiddleware, every page gets theerrorsprop: the validation errors of the request before, or{}. A failed form post now shows its errors with no extra code. TheX-Inertia-Error-Bagheader puts the errors under the bag name. Inertia.flash(req, key, value)sends data to the next page in the top levelflashfield of Inertia 3. It is sent once.- Docs: the setup order
SessionMiddleware,CsrfMiddleware,InertiaMiddleware, and the form flow.
3.0.0-alpha.2 #
- Works with the Inertia 3 client (
@inertiajs/react3 and others). Before, the app did not start, because the client could not find the first page. @inertianow writes<script data-page="app" type="application/json">...</script><div id="app"></div>, not<div id="app" data-page="...">. In the JSON,<,>and&are escaped, so a prop can not end the script tag.- The Inertia 1 and 2 clients are not supported any more.
- The page has
sharedProps: the names of the shared props. The client keeps them on an instant visit. - Docs:
publicDir: falsein thevite.config.jssample, so Vite does not copypublic/intopublic/build.
3.0.0-alpha.1 #
- First version.
inertia(req, component, props)gives the page as JSON to Inertia requests, and as HTML (the root view) to other requests.- Function props run only when they are sent.
- Partial reloads with
onlyandexcept, andInertia.optional,Inertia.always,Inertia.deferandInertia.merge. - Shared props with
InertiaMiddlewareorInertia.share. - Asset version: an old version gets
409withX-Inertia-Location. Inertia.redirectgives303afterPUT,PATCHandDELETE.Inertia.locationgoes to an outside url.@vitein the root view: dev server tags (with React Fast Refresh), or tags from the Vite manifest.