Skip to content

[FR Jetcaster]: Rethink empty, loading, success, and error states in  #1376

@arriolac

Description

@arriolac

Is there an existing issue for this?

  • I have searched the existing issues

Is this a feature request for one of the samples?

  • Yes, this is a specific request related to this samples repo.

Sample app

Jetcaster

Describe the problem

Jetcaster uses a sealed interface to display different states of the UI. For example:

sealed interface ScreenUiState {
    data object Loading : ScreenUiState

    data class Error(
        val errorMessage: String? = null
    ) : ScreenUiState

    data class Ready(
        /* Params here */
    ) : ScreenUiState
}

However, this may not be the best set up UX-wise as intermediate error states would result in the entire screen showing an error vs. showing an error as part of a partially rendered screen.

Describe the solution

A possible solution would be to fold loading and error states into a single screen state data class.

data class ScreenUiState(
    isLoading: Boolean,
    errorMessage: String?,
    /* Params here */
)

Other proposals are welcome.

Additional context

See discussion in #1363 (comment)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requeststaletriage meIssue that needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions