Public API. Handlers return render or location responses, and
wrap-inertia turns them into HTML (first visit) or JSON (Inertia visits).
Public API. Handlers return `render` or `location` responses, and `wrap-inertia` turns them into HTML (first visit) or JSON (Inertia visits).
(always v)Sent on every response, including partial reloads that did not ask for it.
Sent on every response, including partial reloads that did not ask for it.
(deep-merge v)(deep-merge v {:keys [match-on]})The client deep-merges this prop into its current value. :match-on paths
are relative to the prop, e.g. "data.id".
The client deep-merges this prop into its current value. `:match-on` paths are relative to the prop, e.g. "data.id".
(defer f)(defer f group)Skipped on full visits and listed in the page's deferredProps under
group. The client fetches each group with an automatic partial reload
after the page mounts.
Skipped on full visits and listed in the page's `deferredProps` under `group`. The client fetches each group with an automatic partial reload after the page mounts.
(location url)A redirect the client follows with a full page load, e.g. to an external site. Inertia requests get 409 + X-Inertia-Location; others a plain 302.
A redirect the client follows with a full page load, e.g. to an external site. Inertia requests get 409 + X-Inertia-Location; others a plain 302.
(merge v)(merge v {:keys [match-on]})The client appends this prop to its current value instead of replacing it.
:match-on names the field (or fields) used to replace existing items.
The client appends this prop to its current value instead of replacing it. `:match-on` names the field (or fields) used to replace existing items.
(once f)(once f {:keys [key expires-at fresh?]})Resolved once and remembered by the client; later full visits skip it while the client still holds an unexpired copy.
Options: :key client cache key (defaults to the prop name) :expires-at epoch millis, or nil for no expiry :fresh? always resolve and replace the client's copy
Resolved once and remembered by the client; later full visits skip it while the client still holds an unexpired copy. Options: :key client cache key (defaults to the prop name) :expires-at epoch millis, or nil for no expiry :fresh? always resolve and replace the client's copy
(optional f)Skipped on full visits and not announced. Sent only when a partial reload
asks for it, e.g. router.reload({only: ['permissions']}).
Skipped on full visits and not announced. Sent only when a partial reload
asks for it, e.g. `router.reload({only: ['permissions']})`.(prepend v)(prepend v {:keys [match-on]})Like merge, but the client prepends.
Like `merge`, but the client prepends.
(render component)(render component props)(render component props options)A response that renders component with props.
options: :status HTTP status, default 200 :encrypt-history encrypt this page's history entry :clear-history rotate the history encryption key :preserve-fragment keep the URL fragment after a redirect to this page :ssr true or false to use or skip SSR for this response, overriding the middleware's {:ssr {:default ..}}; has no effect when the middleware has no :ssr config
A response that renders `component` with `props`.
options:
:status HTTP status, default 200
:encrypt-history encrypt this page's history entry
:clear-history rotate the history encryption key
:preserve-fragment keep the URL fragment after a redirect to this page
:ssr true or false to use or skip SSR for this response,
overriding the middleware's {:ssr {:default ..}}; has no
effect when the middleware has no :ssr config(scroll f)(scroll f {:keys [data-key meta]})An infinite-scroll prop. The client appends items found under :data-key
(default "data") and uses the scroll metadata to request more pages.
:meta is a map, or a fn of the resolved value, returning any of
:page-name, :previous-page, :next-page, :current-page.
An infinite-scroll prop. The client appends items found under `:data-key` (default "data") and uses the scroll metadata to request more pages. `:meta` is a map, or a fn of the resolved value, returning any of :page-name, :previous-page, :next-page, :current-page.
(share req props)Returns req with props added to the props shared by every page it
renders. Call from your own middleware, before the handler runs.
Returns `req` with `props` added to the props shared by every page it renders. Call from your own middleware, before the handler runs.
(wrap-inertia handler)(wrap-inertia handler opts)Ring middleware that serves Inertia v3 responses.
opts:
:version asset version, a string or 0-arity fn
:template (fn [{:keys [head body page]} req] html-string); body holds
the page script and root element, head any SSR head tags
:share (fn [req] props-map) of props shared by every page
:errors (fn [req] errors-map); default reads (:errors (:flash req))
:flash (fn [req] flash-map); default none
:id root element id, default "app"
:encrypt-history? encrypt history for every page
:json-encode (fn [x] json-string); default jsonista
:ssr nil, or {:url .. :timeout-ms .. :on-error (fn [ex]) :default ..}
:url is the full render endpoint, default
http://127.0.0.1:13714/render. :default (true) says whether
pages use SSR when their render call sets no :ssr option; set
it false and pass {:ssr true} to render to opt pages in.
Ring middleware that serves Inertia v3 responses.
opts:
:version asset version, a string or 0-arity fn
:template (fn [{:keys [head body page]} req] html-string); `body` holds
the page script and root element, `head` any SSR head tags
:share (fn [req] props-map) of props shared by every page
:errors (fn [req] errors-map); default reads (:errors (:flash req))
:flash (fn [req] flash-map); default none
:id root element id, default "app"
:encrypt-history? encrypt history for every page
:json-encode (fn [x] json-string); default jsonista
:ssr nil, or {:url .. :timeout-ms .. :on-error (fn [ex]) :default ..}
:url is the full render endpoint, default
http://127.0.0.1:13714/render. :default (true) says whether
pages use SSR when their render call sets no :ssr option; set
it false and pass {:ssr true} to `render` to opt pages in.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |