Plugin#
- class litestar_vite.inertia.plugin.InertiaPlugin[source]#
Bases:
InitPluginInertia plugin.
This plugin configures Litestar for Inertia.js support, including: - Optional session-backed redirect state - Exception handler for Inertia responses - InertiaRequest and InertiaResponse as default classes - Type encoders for StaticProp and DeferredProp - Shared IPC transport and circuit breaker for SSR
- Async Prop Resolution:
Async
optional()/defer()/lazy()/once()callbacks are pre-resolved byInertiaResponseon the request event loop before the body is serialized. This guarantees they share the loop with request-scoped async resources (asyncpg/aiosqlite/sqlspec sessions), so callbacks can safely use those resources.
Example:
from litestar_vite.inertia import InertiaPlugin, InertiaConfig app = Litestar( plugins=[InertiaPlugin(InertiaConfig())], )
- lifespan(app: Litestar) AsyncGenerator[None, None][source]#
Lifespan to manage the shared SSR IPC transport and circuit breaker.
- property circuit_breaker: SSRCircuitBreaker | None#
Return the active SSRCircuitBreaker instance.
- property ipc_transport: BaseIPCTransport | None#
Return the active BaseIPCTransport instance.