- 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
doFetchnow returns a Promise that always resolves. The value that it resolves to is the same object that is passed toafterFetch. Note thatafterFetchis only called when a network request has actually been performed, whereasdoFetchresolves even when the cache is hit.
Bug Fixes
- Fixes a bug where
isLazywould 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
datafrom 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
responseTypeprop is now more forgiving. If the body cannot be parsed with theresponseTypethat you set, thendatawill 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
lazyprop 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
fetchPolicywould be"cache-first"for "write" requests.
Breaking
transformResponsehas been renamed to betransformDatafetchPolicyis 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
failedproperty 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
responseTypecan now be specified as a function. It receives theresponseas the first argument.- Adds a
requestKeyprop. - When the request is "faux-aborted," the error will have a
nameequal toAbortError. This matches the name of the native error, allowing you to write future-proof code that handles aborted requests.
Breaking
- The
responseTypewill now be set to"text"anytime a response returns with a 204 status code. - The
responseTypeis no longer used when creating the request key.
Changes
fetch-dedupehas 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 useschildrenas the render prop, rather thanrender.