Skip to content
This repository was archived by the owner on Aug 3, 2023. It is now read-only.

Commit 5eddd22

Browse files
authored
Merge pull request #159 from jamesplease/3.0.0
3.0.0
2 parents a5ee7cf + 24546f2 commit 5eddd22

File tree

13 files changed

+205
-150
lines changed

13 files changed

+205
-150
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
### v3.0.0 (2018/4/24)
4+
5+
> Although the changes in this release are technically breaking, they are unlikely to
6+
> affect most users' code.
7+
8+
**Breaking Changes**
9+
10+
* When a request fails, the `data` from a request will no longer be set to `null`. This
11+
allows you to control whether or not your UI continues to display the existing data.
12+
13+
* The `responseType` prop is now more forgiving. If the body cannot be parsed with
14+
the `responseType` that you set, then `data` will be set to `null`.
15+
316
### v2.0.4 (2018/4/20)
417

518
**Bug Fixes**

README.md

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -364,30 +364,8 @@ about the response, such as its status code.
364364
</Fetch>
365365
```
366366
367-
```jsx
368-
// Some "enterprisey" endpoints return text stack traces anytime that they error. A function
369-
// `responseType` can protect you against this.
370-
<Fetch
371-
url="/countries/2"
372-
responseType={response => {
373-
// Only parse as JSON when the request's code is not an error code, and it is
374-
// not 204 No Content.
375-
return response.ok && response.status !== 204 ? 'json' : 'text';
376-
}}
377-
transformData={countryName => {
378-
return {
379-
countryName
380-
};
381-
}}>
382-
{({ data }) => {
383-
if (data) {
384-
return <div>{data.countryName}</div>;
385-
}
386-
387-
return null;
388-
}}
389-
</Fetch>
390-
```
367+
If the response body cannot be parsed as the `responseType` that you specify, then `data` will
368+
be set to `null`.
391369
392370
##### `requestName`
393371

examples/fetch-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"react": "^16.2.0",
77
"react-composer": "^4.1.0",
88
"react-dom": "^16.2.0",
9-
"react-request": "^2.0.4",
9+
"react-request": "^3.0.0",
1010
"react-scripts": "1.1.0"
1111
},
1212
"scripts": {

examples/lazy-read/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"dependencies": {
66
"react": "^16.2.0",
77
"react-dom": "^16.2.0",
8-
"react-request": "^2.0.4",
8+
"react-request": "^3.0.0",
99
"react-scripts": "1.1.0"
1010
},
1111
"scripts": {

examples/multiple-requests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"react": "^16.2.0",
77
"react-composer": "^4.1.0",
88
"react-dom": "^16.2.0",
9-
"react-request": "^2.0.4",
9+
"react-request": "^3.0.0",
1010
"react-scripts": "1.1.0"
1111
},
1212
"scripts": {

examples/request-deduplication/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"dependencies": {
66
"react": "^16.2.0",
77
"react-dom": "^16.2.0",
8-
"react-request": "^2.0.4",
8+
"react-request": "^3.0.0",
99
"react-scripts": "1.1.0"
1010
},
1111
"scripts": {

examples/response-caching/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"dependencies": {
66
"react": "^16.2.0",
77
"react-dom": "^16.2.0",
8-
"react-request": "^2.0.4",
8+
"react-request": "^3.0.0",
99
"react-scripts": "1.1.0"
1010
},
1111
"scripts": {

examples/simple-read/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"dependencies": {
66
"react": "^16.2.0",
77
"react-dom": "^16.2.0",
8-
"react-request": "^2.0.4",
8+
"react-request": "^3.0.0",
99
"react-scripts": "1.1.0"
1010
},
1111
"scripts": {

examples/updating-a-resource/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"dependencies": {
66
"react": "^16.2.0",
77
"react-dom": "^16.2.0",
8-
"react-request": "^2.0.4",
8+
"react-request": "^3.0.0",
99
"react-scripts": "1.1.0"
1010
},
1111
"scripts": {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-request",
3-
"version": "2.0.4",
3+
"version": "3.0.0",
44
"description": "Declarative HTTP requests with React.",
55
"main": "lib/index.js",
66
"module": "es/index.js",
@@ -83,7 +83,7 @@
8383
"rollup-plugin-uglify": "^2.0.1"
8484
},
8585
"dependencies": {
86-
"fetch-dedupe": "^2.1.0",
86+
"fetch-dedupe": "^3.0.0",
8787
"prop-types": "^15.6.0"
8888
}
8989
}

0 commit comments

Comments
 (0)