Inertia Helpers¶
- litestar_vite.inertia.helpers.lazy(key: str, value_or_callable: None) StaticProp[str, None] [source]¶
- litestar_vite.inertia.helpers.lazy(key: str, value_or_callable: T) StaticProp[str, T]
- litestar_vite.inertia.helpers.lazy(key: str, value_or_callable: Callable[[...], None] = None) DeferredProp[str, None]
- litestar_vite.inertia.helpers.lazy(key: str, value_or_callable: Callable[[...], Coroutine[Any, Any, None]] = None) DeferredProp[str, None]
- litestar_vite.inertia.helpers.lazy(key: str, value_or_callable: Callable[[...], T | Coroutine[Any, Any, T]] = None) DeferredProp[str, T]
Wrap an async function to return a DeferredProp.
- class litestar_vite.inertia.helpers.StaticProp[source]¶
Bases:
Generic
[PropKeyT
,StaticT
]A wrapper for static property evaluation.
- class litestar_vite.inertia.helpers.DeferredProp[source]¶
Bases:
Generic
[PropKeyT
,T
]A wrapper for deferred property evaluation.
- litestar_vite.inertia.helpers.is_lazy_prop(value: Any) TypeGuard[DeferredProp[Any, Any]] [source]¶
Check if value is a deferred property.
- Parameters:
value – Any value to check
- Returns:
True if value is a deferred property
- Return type:
- litestar_vite.inertia.helpers.should_render(value: Any, partial_data: set[str] | None = None) bool [source]¶
Check if value should be rendered.
- Parameters:
value – Any value to check
partial_data – Optional set of keys for partial rendering
- Returns:
True if value should be rendered
- Return type:
- litestar_vite.inertia.helpers.is_or_contains_lazy_prop(value: Any) bool [source]¶
Check if value is or contains a deferred property.
- Parameters:
value – Any value to check
- Returns:
True if value is or contains a deferred property
- Return type:
- litestar_vite.inertia.helpers.lazy_render(value: T, partial_data: set[str] | None = None, portal: BlockingPortal | None = None) T [source]¶
Filter deferred properties from the value based on partial data.
- Parameters:
value – The value to filter
partial_data – Keys for partial rendering
portal – Optional portal to use for async rendering
- Returns:
The filtered value
Return shared session props for a request.
- Parameters:
request – The ASGI connection.
partial_data – Optional set of keys for partial rendering.
portal – Optional portal to use for async rendering
- Returns:
The shared props.
- Return type:
Dict[str, Any]
Note
Be sure to call this before self.create_template_context if you would like to include the flash message details.
Share a value in the session.
- Parameters:
connection – The ASGI connection.
key – The key to store the value under.
value – The value to store.