MCPcopy Index your code
hub / github.com/angular/angular / projectStatusOfState

Function projectStatusOfState

packages/core/src/resource/resource.ts:574–583  ·  view source on GitHub ↗

* Project from a state with `ResourceInternalStatus` to the user-facing `ResourceStatus`

(state: ResourceState<unknown>)

Source from the content-addressed store, hash-verified

572 * Project from a state with `ResourceInternalStatus` to the user-facing `ResourceStatus`
573 */
574function projectStatusOfState(state: ResourceState<unknown>): ResourceStatus {
575 switch (state.status) {
576 case 'loading':
577 return state.extRequest.reload === 0 ? 'loading' : 'reloading';
578 case 'resolved':
579 return isResolved(state.stream!()) ? 'resolved' : 'error';
580 default:
581 return state.status;
582 }
583}
584
585function isResolved<T>(state: ResourceStreamItem<T>): state is {value: T} {
586 return (state as {error: unknown}).error === undefined;

Callers 1

constructorMethod · 0.85

Calls 1

isResolvedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…