Skip to content

"isLoading" slightly misleading #2

@philip-peterson

Description

@philip-peterson

When I saw the existence of isLoading, I assumed it would be true from the moment the react-async component mounted until the query promise I provided was completed. Instead, though, isLoading is momentarily false for the first render or so, until the state has had a chance to update, because the component doesn't know that a promiseFn was necessarily provided.

Two options I see:

  • on construction, set isLoading to true if there is a promiseFn provided and it produces a promise
  • naming clarity: provide a new param, isReady that is set to !!finishedAt
  • provision of some kind of warning in the documentation about isLoading not being true initially.

The first option is probably the most intuitive for the user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions