Skip to main content
cngx-src documentation

CngxAsyncState

Interface

projects/core/utils/async-state.ts

Referenced by#

Import#

import { CngxAsyncState } from '@cngx/core/utils'

Description#

UX state machine interface for any asynchronous operation.

This is UX state, not data state. It answers "What should the user see right now?" — not "What is the data?" It drives skeleton, loading bar, toast, empty state, and ARIA communication. It does not replace SignalStore, NgRx, or any data store — it composes with them.

Every derived value is a computed() from a single source (status). The system cannot become inconsistent.

All UI feedback components accept CngxAsyncState<unknown> as input — typed on the interface, not on a concrete implementation.

Index#

Instance Properties#

data#Signal
Readonly

The most recent successful result, or undefined.

error#Signal
Readonly

The most recent error, or undefined.

hasData#Signal
Readonly

true if data is present and not empty.

isBusy#Signal
Readonly

ARIA-oriented alias for isLoading. Maps directly to aria-busy — always true when any operation runs.

isEmpty#Signal
Readonly

true if data is an empty array, null, or undefined.

isFirstLoad#Signal
Readonly

true if no successful load has completed yet.

isLoading#Signal
Readonly

true when any operation is running (loading, pending, or refreshing).

isPending#Signal
Readonly

true only when a mutation is running (pending).

isRefreshing#Signal
Readonly

true only when refreshing (re-query with stale data visible).

isSettled#Signal
Readonly

true when the operation has settled (success or error).

lastUpdated#Signal
Readonly

Timestamp of the last successful load, or undefined.

progress#Signal
Readonly

Progress 0–100, or undefined for indeterminate.

status#Signal
Readonly

Current status of the async operation. Single source of truth.