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
suspense
flag [@ghengeveld in #153] - Allow overriding fetch's
resource
argument when invokingrun
throughuseFetch
[@ghengeveld in #150] - Make sure
useFetch
rejects with anError
type [@artdent in #114] - Fix the
promise
render prop, so it's always a Promise [@ghengeveld in #148] - Add
displayName
to thecreateInstance
TypeScript 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
useFetch
and are using theerror
value, expecting it to be of typeResponse
, you must now useerror.response
instead.
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.