CgsStreamState
The state of an observed value: what the SDK currently holds, and what it is doing about it.
This is what every get(id, scope) emits. Unlike a plain success-or-failure, a failure can still carry the last known data, so a network blip never has to blank the screen:
CGS.content().issues.get(issueId, viewModelScope).collect { state ->
when (state) {
is CgsStreamState.Refreshing -> { state.data?.let(::render); showSpinner() }
is CgsStreamState.Success -> { render(state.data); hideSpinner() }
is CgsStreamState.Failure -> {
state.data?.let(::render) // keep the stale value on screen
showError(state.cgsError)
}
}
}Content copied to clipboard
One exception: after the signed-in account or the active profile changes, the SDK drops what it held, so a Failure following such a change carries at most what was cached for the new session. It is never one profile's content shown under another's.
Parameters
T
the observed value.
Inheritors
Functions
Link copied to clipboard
This state as a Refreshing one, keeping whatever data it holds.