v9.0.0: The one with Suspense support
This release adds basic, experimental support for Suspense. Furthermore it contains mostly bugfixes, one of which causes a minor but breaking change for useFetch.
- Enable experimental support for Suspense by passing the
suspenseflag [@ghengeveld in #153] - Allow overriding fetch's
resourceargument when invokingrunthroughuseFetch[@ghengeveld in #150] - Make sure
useFetchrejects with anErrortype [@artdent in #114] - Fix the
promiserender prop, so it's always a Promise [@ghengeveld in #148] - Add
displayNameto thecreateInstanceTypeScript definition [@artdent in #102] - Fix TypeScript module interop by avoiding synthetic default imports [@rokoroku in #112]
- Remove some TypeScript definitions without implementation [@Khartir in #107]
- Setup new documentation site (https://docs.react-async.com)
Breaking changes
useFetch rejection type
Previously with useFetch, a failure response would reject with the response object. It's better for rejections to be of type Error so that the full stack trace information is available. Also, the TypeScript type definition assumes that the error object is always an instance of Error. Therefore, the rejection value is now of type FetchError (a subclass of Error) which adds the response property so you can still access the underlying response, without breaking contract.
What to do:
- If you are using
useFetchand are using theerrorvalue, expecting it to be of typeResponse, you must now useerror.responseinstead.
Experimental Suspense support
Due to its experimental nature, we may make breaking changes to this feature even in minor or patch releases, until Suspense for data fetching is officially released. Until then, this is marked experimental.