Pure function that resolves which view to show based on async state
resolveAsyncView
Functioncommon/data/async-state
projects/common/data/async-state/resolve-view.ts
Description#
Pure function that resolves which view to show based on async state.
Encodes the state machine as a lookup table — no branching:
| status | firstLoad | empty | view |
|---|---|---|---|
| idle | true | * | none |
| loading | true | * | skeleton |
| refreshing | true | * | skeleton |
| pending | true | * | skeleton |
| error | true | * | error |
| success | * | true | empty |
| error | false | * | content+error |
| (all other) | * | * | content |