Skip to content

Releases: async-library/react-async

v6.1.0: Control state reducer and dispatcher

27 Apr 13:33
Compare
Choose a tag to compare

This adds two new props/options: reducer and dispatcher. These wrap the internal reducer and dispatcher to allow full control over React Async's internal state management. It also makes invocation of the promiseFn / deferFn part of the dispatched action so it can be delayed, cached or scheduled.

See https://github.com/ghengeveld/react-async/blob/master/README.md#reducer for details.

v6.0.2: Update run/reload methods when dependent props change

03 Apr 17:36
Compare
Choose a tag to compare

v6.0.1: Fix initialValue type signature for TypeScript

29 Mar 14:19
Compare
Choose a tag to compare
  • This fixes the type signature for initialValue to allow an Error as initial value.
  • AsyncInitial now specifies initialValue as undefined because you can never have one in the initial state.

v6.0.0: Status prop to match Promise specification

29 Mar 10:42
Compare
Choose a tag to compare

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>.

v5.1.2: Export types and interfaces

21 Mar 14:21
Compare
Choose a tag to compare
  • Better TypeScript support by exporting our own types and interfaces so you won't have to define them again yourself.
  • Replaced custom Fetch API types with the ones from the standard library.

v5.1.1: TypeScript support for additional props

14 Mar 13:28
Compare
Choose a tag to compare
  • Add indexer for additional props to AsyncOptions type

v5.1.0: defer and json options for useFetch

09 Mar 16:17
Compare
Choose a tag to compare
  • Added defer and json options to useFetch

This allows you to override the default behavior, which tries to infer the choice automatically.

v5.0.0: Optimized builds and `promise` prop

03 Mar 23:26
Compare
Choose a tag to compare

This major release changes the way the code is bundled and published by adopting @pika/pack. We now ship separate bundles optimized for browsers and Node.js as well as the original "esnext" source code. package.json now specifies the following:

"esnext": "dist-src/index.js",
"main": "dist-node/index.js",
"module": "dist-web/index.js",
"types": "dist-types/index.d.ts"

This should not break your app, but if it does, please let us know.

New prop: promise

This release also adds a new promise prop, which allows you to pass an already instantiated Promise rather than a function that returns a Promise. This comes with a few limitations:

  • You cannot use reload(), it will do nothing.
  • There's no way to pass props/arguments to the Promise instantiation.
  • The AbortController isn't available either.

v4.1.2: Fix invalid arguments order in typings

27 Feb 13:25
Compare
Choose a tag to compare
  • Fix invalid arguments order in TypeScript typings.
  • Updated Babel setup in preparation of moving to Babel v7.

v4.1.1: Fix broken export

20 Feb 08:31
Compare
Choose a tag to compare

A previous change accidentally broke the default export. This release fixes the bug and tests have been updated to guard against it.