Function perseus::state::compute_nested_suspense
source · pub fn compute_nested_suspense<'a, T, E, F>(
cx: Scope<'a>,
state: RxResultRx<T, E>,
handler: F
)where
F: Future<Output = Result<(), E>> + 'a,
T: MakeRx + Serialize + DeserializeOwned + Clone + 'static,
<T as MakeRx>::Rx: MakeUnrx<Unrx = T> + Freeze + Clone + 'static,
E: Serialize + DeserializeOwned + Clone + 'static,
Expand description
A utility function for calling suspense handlers and managing their errors.
This automatically implements the pattern of allowing suspense handlers to
return arbitrary errors that will be set, enabling the more convenient use
of ?
in those handlers.
Note that this function should only be used for suspense fields that are
also reactively nested, and therefore that use RxResult
.
You shouldn’t need to do this unless you’re manually deriving the traits for the reactive state platform.
Note that this will simply start an asynchronous call to run the suspense handler, managing any errors.
The handler this takes is a future, so the asynchronous function handler
itself should be called without .await
before being provided to this
function.