- React 17 is now included in peer dependencies.
Bug Fixes
- Fixes a bug that can occur in React Native environments
Bug Fixes
- A race condition has been fixed.
New Features
doFetch
now returns a Promise that always resolves. The value that it resolves to is the same object that is passed toafterFetch
. Note thatafterFetch
is only called when a network request has actually been performed, whereasdoFetch
resolves even when the cache is hit.
Bug Fixes
- Fixes a bug where
isLazy
would sometimes be computed using previous props rather than the current props.
Although the changes in this release are technically breaking, they are unlikely to affect most users' code.
Breaking Changes
-
When a request fails, the
data
from a request will no longer be set tonull
. This allows you to control whether or not your UI continues to display the existing data. -
The
responseType
prop is now more forgiving. If the body cannot be parsed with theresponseType
that you set, thendata
will be set tonull
.
Bug Fixes
- Fixes a bug where there could be a cache mismatch when re-rendering the same component that has a fetch policy configured.
Bug Fixes
- Fixes a bug where the
lazy
prop was not always respected. Anytime that a new request key was generated, a request would be made.
Bug Fixes
- Fixes a bug where an Uncaught ReferenceError could be thrown
Bug Fixes
- This fixes a problem where the default
fetchPolicy
would be"cache-first"
for "write" requests.
Breaking
transformResponse
has been renamed to betransformData
fetchPolicy
is now determined by the method that you pass in. This change was made to support using POST methods for read requests, and is unlikely to break your code.- A new prop,
cacheResponse
, is used to determine if a response is added to the cache or not. This is to support using POST methods for read requests, and is unlikely to break your code.
New Features
- A new
failed
property is passed to you in the render prop callback. This allows you to quickly determine if a request failed for any reason (be it network errors or "error" status codes).
New Features
responseType
can now be specified as a function. It receives theresponse
as the first argument.- Adds a
requestKey
prop. - When the request is "faux-aborted," the error will have a
name
equal toAbortError
. This matches the name of the native error, allowing you to write future-proof code that handles aborted requests.
Breaking
- The
responseType
will now be set to"text"
anytime a response returns with a 204 status code. - The
responseType
is no longer used when creating the request key.
Changes
fetch-dedupe
has been abstracted into a separate library. This does not change the public API of this library.
New Features
- The render prop will now be passed the
requestKey
.
React's new Context API has been finalized, and it uses functional children
rather than a prop
named render
. Accordingly, this library has been updated to use children
as the default.
Breaking
<Fetch/>
now useschildren
as the render prop, rather thanrender
.