pub fn compute_suspense<'a, T, E, F>(
    cx: Scope<'a>,
    state: RcSignal<Result<T, E>>,
    handler: F
)where
    F: Future<Output = Result<(), E>> + 'a,
    T: Serialize + DeserializeOwned + 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 not reactively nested, and that therefore use a standard Result<T, E>.

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.