Skip to content

React: Don't throw an error when usePGlite() doesn't find a PGlite instance #878

@wallzero

Description

@wallzero

At the moment when PGlite is loading asynchronously, the UI has to wait. Otherwise anything using usePGlite() causes an error:

Uncaught Error: No PGlite instance found, use PGliteProvider to provide one

I can't easily wrap it in a try/catch because this is a hook.

Could usePGlite() just return null so the UI can handle around it until the DB loads?

Thanks!

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