Responses and props

Responses

Call Result
(inertia/render component props) HTML on the first visit, JSON on Inertia visits
(inertia/render component props {:encrypt-history true :clear-history true :preserve-fragment true :ssr false :status 200}) Same response, with per-response options
(inertia/location url) Full page load to url: 409 + X-Inertia-Location, or a plain 302 for non-Inertia requests
any Ring redirect 302 becomes 303 after PUT/PATCH/DELETE; a #fragment target becomes 409 + X-Inertia-Redirect

Prop types

Prop First visit Partial reload
plain value or (fn [] ...) sent; fns are called sent only if requested
(optional f) skipped sent only if requested
(defer f group) skipped, listed in deferredProps; the client fetches each group right after mount sent when requested
(always v) sent always sent, even if not requested
(merge v), (prepend v), (deep-merge v), with {:match-on "id"} client merges instead of replacing same, unless listed in X-Inertia-Reset
(once f {:key .. :expires-at ..}) skipped while the client holds a copy sent when requested
(scroll f {:meta (fn [v] {:current-page .. :next-page ..})}) infinite-scroll prop, appends under data same

These constructors compose, so (merge (defer f)) is valid. defer and optional require a fn. Nested fns inside a prop’s value are resolved too. Dot paths such as only: ['auth.user'] resolve only the selected branch.

See the inertia.core API reference for each constructor’s options.