Errors, flash and shared props

Validation errors and flash

errors is always sent and defaults to {}. By default the middleware reads (:errors (:flash req)), so a failed form can redirect back with:

(assoc (resp/redirect "/users/create") :flash {:errors {:name "Required"}})

Pass :errors to wrap-inertia to read errors from somewhere else. Pass :flash (fn [req] ...) to fill the page’s flash key, which the client reads as usePage().flash.

Shared props

Use the :share fn for props every page needs. Use (inertia/share req {...}) in your own middleware, upstream of the handler, for request-specific props. Page props override shared props.