Skip to content

v6.21.0

Choose a tag to compare

@alex-up-bot alex-up-bot released this 18 May 00:51
· 128 commits to main since this release

v6.21.0 (Minor Release)

Status: Released

This is a new minor release of the @alextheman/components package. It introduces new features and other backwards-compatible changes that should require little to no refactoring. Please read the description of changes below.

Description of Changes

  • Export the useQueryBoundary hook
    • I can't believe all this time it was never exported...
    • This can be used to access the context value provided by the QueryBoundaryProvider component (or the QueryBoundary.Context using the compound component pattern), which can often be helpful in cases where you're creating your own QueryBoundary component that listens out for the same query state.
    • It is different to createQueryBoundary because that function solely creates the compound QueryBoundary namespace, whereas this useQueryBoundary hook gives you direct access to the isLoading, error, and data states.
  • Fix check ordering in QueryBoundaryData
    • This re-orders the checks so that we check for an error first, and if there is an error, we return null out of QueryBoundaryData (so it can be handled by QueryBoundaryError).
    • Previously, if loading and error state existed at the same time, the loading component would show at the same time as the error component, which was not ideal. With this change, the error component will return early, ensuring that the loading component (along with the data) does not show if there is an error.