dark
dark copied to clipboard
Error boundaries and useQuery
This is a feature(s) request.
@dark-engine/core
currently doesn't have error boundaries.
Error boundaries are similar to Suspense
: while Suspense
"catches" promises, error boundaries catch errors. For this reason, in the React ecosystem these 2 are used together.
An error boundary would simplify useQuery
usage with the suspense-only
strategy, given the following changes:
- Suspend when
isFetching
- Throw error when
error && (typeof data === 'undefined')
. This error can be caught by an error boundary
This behavior guarantees data
is defined when the component renders. Error handling and fallback can be moved outside of the component definition.
This feature request should be marked with low priority since useQuery
{strategy: 'state-only'}
is also available and would remain unchanged.