Skip to content

[FEATURE] Add suspense/loading support in "Declarative" (component-based) API #1321

@toddbaert

Description

@toddbaert

Requirements

With #1164, we added a new component-based API. This doesn't yet support any kind of "loading" or suspense until the provider is ready, or while context is being reconciled.

We should support this. There's some design choices to be made here. Consider how to give users control, as well as reasonable defaults, and also how to be consistent with similar configuration options elsewhere.

I see 2 possibilities (both may be valuable):

  • add a suspend option as we have in our hooks:
    Use `useSuspenseFlag` or pass `{ suspend: true }` in the hook options to leverage this functionality.
    • we probably want to respect the settings at the context-provider level as well, similar to the way our hooks do.
  • add a "loading" template option (I'm less sure about this, since suspense is essentially a native means of doing this)
    • this would be displayed during provider reconciliation, or while the provider is not ready
    • try to avoid duplication with existing suspense usage
    • again, the best option may be to simply not include this, but I'm not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions