Rendering
from inertia import Inertia, lazy, defer
def dashboard(): return Inertia.render("Dashboard", { "user": user, "stats": lazy(lambda: expensive_stats()), "notes": defer(lambda: load_notes()), })| Visit type | Response |
|---|---|
First (no X-Inertia) |
Root Prism template with @inertia / @inertiaHead |
Inertia (X-Inertia: true) |
JSON page object |
| Version mismatch | 409 + X-Inertia-Location |
| External redirect | Inertia.location(url) → 409 + X-Inertia-Location |
The page url is built with url() so APP_BASE_PATH is honored.
Partial reloads
Section titled “Partial reloads”Headers:
X-Inertia-Partial-ComponentX-Inertia-Partial-Data(comma list)X-Inertia-Partial-Except
Root template
Section titled “Root template”<!DOCTYPE html><html><head> @inertiaHead @vite(['resources/js/app.jsx'])</head><body> @inertia</body></html>Asset versioning
Section titled “Asset versioning”Inertia.set_version("v42")# or config inertia.versionMiddleware HandleInertiaRequests (alias inertia) compares
X-Inertia-Version and forces a full reload on mismatch.