Skip to content

useAsyncOperation

useAsyncOperation(operationId, options?): object

Defined in: store/StoreProvider.tsx:398

Hook scoped to a single async operation. Spreads the AsyncOperation record onto the returned object and adds derived isLoading / hasError booleans.

By default, the slot is cleared when the component unmounts — _async is request lifecycle metadata, not data cache. If multiple components watch the same op (e.g., a header spinner + a content body), pass { clearOnUnmount: false } on all but one to keep the record alive.

ParameterType
operationIdstring
options?{ clearOnUnmount?: boolean; }
options.clearOnUnmount?boolean

object

clear: () => void

void

data: any = op.data

endTime: number | undefined = op.endTime

error: string | undefined = op.error

hasError: boolean

id: string | undefined = op.id

isLoading: boolean

startTime: number | undefined = op.startTime

status: "idle" | "loading" | "success" | "error" | "cancelled" | undefined = op.status

strategy: AsyncConcurrencyStrategy | undefined = op.strategy