atellmer / dark

The lightweight and powerful UI rendering engine without dependencies and written in TypeScript💫 (Browser, Node.js, Android, iOS, Windows, Linux, macOS)
MIT License
41 stars 1 forks source link

Error boundaries and useQuery #91

Open einar-hjortdal opened 1 month ago

einar-hjortdal commented 1 month ago

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:

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.

atellmer commented 1 month ago

You should also pay attention to the useError hook.