Skip to content

v6.0.0: Status prop to match Promise specification

Compare
Choose a tag to compare
@ghengeveld ghengeveld released this 29 Mar 10:42
· 554 commits to master since this release

This major release introduces a new status prop which closely follows the terminology in the Promise specification. The Pending helper component was renamed to Initial accordingly, causing a breaking change. The new status prop comes with separate TypeScript types for each state, allowing us to make many optional properties required. This should improve usability in a TypeScript codebase.

  • Breaking change: Async.Pending was renamed to Async.Initial
  • Added the status prop, which can be one of initial, pending, fulfilled or rejected
  • Added isInitial, isPending, isFulfilled (with alias isResolved), isRejected and isSettled boolean props. isLoading is now an alias for isPending.
  • Added separate TypeScript types for each status, to make various props non-optional.

Required upgrade steps:

  • Rename all instances of <Async.Pending> to <Async.Initial>. Don't forget to deal with custom instances of <Async>.

Optional upgrade steps (these are now aliases):

  • Rename isLoading to isPending.
  • Rename <Async.Loading> to <Async.Pending>.
  • Rename <Async.Resolved> to <Async.Fulfilled>.