Expand description
§About the async signal
leptos_async_signal
is a library built on top of
Leptos that extends the functionality of Leptos signals
to provide a mechanism for generating values asynchronously. This library
is particularly useful in server-side rendering (SSR) contexts where
certain application elements need to be generated asynchronously before the
associated signal is set.
§Use case
A typical example is generating breadcrumbs for a page. Breadcrumbs, which
appear at the top of the page, often depend on deeper page elements or
server-side data. With leptos_async_signal
, you can generate these
breadcrumbs asynchronously in SSR mode and still allow them to react to
changes dynamically in other modes.
This pattern mimics the behavior of leptos_meta
for managing HTML meta
elements but extends the functionality to any application element.
§Example
Check the breadcrumbs example in the repository.
§Leptos versions
The latest supported Leptos version is 0.8.x
. See the table below for
version compatibility:
leptos | leptos_async_signal |
---|---|
0.8.x | 0.6.0 |
0.7.x | 0.5.0 |
Structs§
- Async
Write Signal - An async write signal. This is almost the same as the regular Leptos (Arc) write signal, but under the hood also takes care of notifying the resource paired with this signal about the new value (in SSR mode).
Functions§
- async_
signal - Creates a new async signal, that is, the pairing of a resource with an
async write signal. The default provided value is used as a placeholder
value in the case that the async write signal is never written to. How
this works is documented by
AsyncWriteSignal
.