Skip to content

v9.0.0: The one with Suspense support

Compare
Choose a tag to compare
@ghengeveld ghengeveld released this 07 Oct 09:53
· 443 commits to next since this release

πŸ‘‰ Read the announcement blog post

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 invoking run through useFetch [@ghengeveld in #150]
  • Make sure useFetch rejects with an Error type [@artdent in #114]
  • Fix the promise render prop, so it's always a Promise [@ghengeveld in #148]
  • Add displayName to the createInstance 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 the error value, expecting it to be of type Response, you must now use error.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.