MCPcopy Index your code
hub / github.com/FirebaseExtended/reactfire / ObservableStatus

Interface ObservableStatus

src/useObservable.ts:29–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29export interface ObservableStatus<T> {
30 /**
31 * The loading status.
32 *
33 * - `loading`: Waiting for the first value from an observable
34 * - `error`: Something went wrong. Check `ObservableStatus.error` for more details
35 * - `success`: The hook has emitted at least one value
36 *
37 * If `initialData` is passed in, this will skip `loading` and go straight to `success`.
38 */
39 status: 'loading' | 'error' | 'success';
40 /**
41 * Indicates whether the hook has emitted a value at some point
42 *
43 * If `initialData` is passed in, this will be `true`.
44 */
45 hasEmitted: boolean; // has received at least one value
46 /**
47 * If this is `true`, the hook will be emitting no further items.
48 */
49 isComplete: boolean;
50 /**
51 * The most recent value.
52 *
53 * If `initialData` is passed in, the first value of `data` will be the valuea provided in `initialData` **UNLESS** the underlying observable is ready, in which case it will skip `initialData`.
54 */
55 data: T;
56 /**
57 * Any error that may have occurred in the underlying observable
58 */
59 error: Error | undefined;
60 /**
61 * Promise that resolves after first emit from observable
62 */
63 firstValuePromise: Promise<void>;
64}
65
66function reducerFactory<T>(observable: SuspenseSubject<T>) {
67 return function reducer(state: ObservableStatus<T>, action: 'value' | 'error' | 'complete'): ObservableStatus<T> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected