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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
operationId | string |
options? | { clearOnUnmount?: boolean; } |
options.clearOnUnmount? | boolean |
Returns
Section titled “Returns”object
clear: () =>
void
Returns
Section titled “Returns”void
data:
any=op.data
endTime
Section titled “endTime”endTime:
number|undefined=op.endTime
error:
string|undefined=op.error
hasError
Section titled “hasError”hasError:
boolean
id:
string|undefined=op.id
isLoading
Section titled “isLoading”isLoading:
boolean
startTime
Section titled “startTime”startTime:
number|undefined=op.startTime
status
Section titled “status”status:
"idle"|"loading"|"success"|"error"|"cancelled"|undefined=op.status
strategy
Section titled “strategy”strategy:
AsyncConcurrencyStrategy|undefined=op.strategy