euv-ui 0.28.34

Reusable UI component library for the euv framework, providing buttons, cards, modals, inputs, and more.
Documentation
use super::*;

/// Obtains a `SuspenseHandle` registered against the current hook context slot.
///
/// Behaves like `HookContext::use_hook` - the same `SuspenseHandle` is
/// returned on every render at the same hook index, preserving the
/// `Pending` / `Resolved(value)` / `Failed(message)` phase across renders.
///
/// Pair the returned handle with [`SuspenseHandle::resolve_sync`] /
/// [`SuspenseHandle::fail`] to transition the phase. The phase itself is a
/// signal, so any transition re-runs the components that read it; the handle
/// exposes no accessor for the current value.
///
/// # Returns
///
/// - `SuspenseHandle<T>` - The suspense handle.
///   Returns the factory result directly when no hook context is
///   active (e.g. when called outside a render cycle).
pub fn use_suspense<T>() -> SuspenseHandle<T>
where
    T: Clone + PartialEq + Debug + 'static,
{
    HookContext::use_hook(SuspenseHandle::<T>::new)
}