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

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jamesplease/react-request
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1.0
Choose a base ref
...
head repository: jamesplease/react-request
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Feb 8, 2018

  1. Copy the full SHA
    d646b16 View commit details
  2. Copy the full SHA
    82b4330 View commit details
  3. Copy the full SHA
    2dab2f0 View commit details
  4. Copy the full SHA
    aaaf25d View commit details
  5. Copy the full SHA
    9704d79 View commit details
  6. Merge pull request #117 from jmeas/update-examples

    Update examples
    jamesplease authored Feb 8, 2018
    Copy the full SHA
    9bef80c View commit details
  7. Copy the full SHA
    2fa81e8 View commit details
  8. Merge pull request #118 from jmeas/roadmap

    Add roadmap to the project
    jamesplease authored Feb 8, 2018
    Copy the full SHA
    fa77add View commit details
  9. Update README

    jamesplease committed Feb 8, 2018
    Copy the full SHA
    26d7149 View commit details
  10. Update FAQ

    jamesplease committed Feb 8, 2018
    Copy the full SHA
    711b924 View commit details
  11. Copy the full SHA
    fd76a32 View commit details
  12. Merge pull request #119 from jmeas/faq

    Update FAQ
    jamesplease authored Feb 8, 2018
    Copy the full SHA
    6b8d70e View commit details
  13. Merge pull request #120 from jmeas/mo-update

    Remove the "Why JSX?" guide
    jamesplease authored Feb 8, 2018
    Copy the full SHA
    e955e09 View commit details
  14. Copy the full SHA
    bf2b5d5 View commit details
  15. Merge pull request #121 from jmeas/dynamic-lazy

    Add dynamic lazy usage to the lazy guide
    jamesplease authored Feb 8, 2018
    Copy the full SHA
    cfeb48f View commit details
  16. Copy the full SHA
    67edbee View commit details
  17. Merge pull request #122 from jmeas/updatez

    Tidying up the documentation
    jamesplease authored Feb 8, 2018
    Copy the full SHA
    705d3d1 View commit details
  18. Update wording of FAQ

    jamesplease authored Feb 8, 2018
    Copy the full SHA
    bf6571a View commit details
  19. Copy the full SHA
    b2e4755 View commit details
  20. Merge pull request #123 from jmeas/why

    Add "why" question to the FAQ
    jamesplease authored Feb 8, 2018
    Copy the full SHA
    0479122 View commit details
  21. Copy the full SHA
    52e1f6d View commit details

Commits on Feb 10, 2018

  1. Copy the full SHA
    7d5e6ed View commit details
  2. Merge pull request #124 from jmeas/update-example

    Update Fetch Composer dependency version in examples
    jamesplease authored Feb 10, 2018
    Copy the full SHA
    89dedf1 View commit details

Commits on Feb 16, 2018

  1. Fix documentation error for prop name

    `transformData` is actually currently `transformResponse`
    jamesplease authored Feb 16, 2018
    Copy the full SHA
    cf188ac View commit details

Commits on Feb 17, 2018

  1. Copy the full SHA
    a0bd010 View commit details
  2. Copy the full SHA
    23bad3b View commit details
  3. Merge pull request #128 from jmeas/dynamic-cache

    Update caching strategy props
    jamesplease authored Feb 17, 2018
    Copy the full SHA
    a53b61f View commit details
  4. Copy the full SHA
    8881e45 View commit details
  5. Merge pull request #129 from jmeas/failure

    Add failed property to render props argument
    jamesplease authored Feb 17, 2018
    Copy the full SHA
    8ecfd12 View commit details
  6. Copy the full SHA
    210fc9a View commit details
  7. 2.0.0

    jamesplease committed Feb 17, 2018
    Copy the full SHA
    83d297c View commit details
  8. Merge pull request #130 from jmeas/2.0.0

    2.0.0
    jamesplease authored Feb 17, 2018
    Copy the full SHA
    515312b View commit details

Commits on Feb 18, 2018

  1. Copy the full SHA
    b23ff5b View commit details
  2. 2.0.1

    jamesplease committed Feb 18, 2018
    Copy the full SHA
    733fbfa View commit details
  3. Merge pull request #131 from jmeas/2.0.1

    2.0.1
    jamesplease authored Feb 18, 2018
    Copy the full SHA
    14bfadd View commit details

Commits on Feb 19, 2018

  1. Copy the full SHA
    8b0c812 View commit details

Commits on Feb 21, 2018

  1. Copy the full SHA
    2554e42 View commit details
  2. Copy the full SHA
    0fadfe1 View commit details
  3. 2.0.2

    jamesplease committed Feb 21, 2018
    Copy the full SHA
    8fe517d View commit details
  4. Merge pull request #135 from jamesplease/bug-fixies

    Add ESLint rule to catch unused variable use
    jamesplease authored Feb 21, 2018
    Copy the full SHA
    a61c123 View commit details

Commits on Feb 25, 2018

  1. Copy the full SHA
    4ed40f1 View commit details
  2. Merge pull request #136 from jamesplease/update-docs

    Update docs; reorder table of contents
    jamesplease authored Feb 25, 2018
    Copy the full SHA
    027e771 View commit details
  3. Update guides readme page

    jamesplease committed Feb 25, 2018
    Copy the full SHA
    b5f9a4f View commit details

Commits on Mar 3, 2018

  1. Copy the full SHA
    5ccdf1a View commit details
  2. 2.0.3-beta1

    jamesplease committed Mar 3, 2018
    Copy the full SHA
    88520b9 View commit details
  3. 2.0.3

    jamesplease committed Mar 3, 2018
    Copy the full SHA
    abfbc3f View commit details
  4. Merge pull request #139 from jamesplease/bug-fixies

    Add test demonstrating gh-137
    jamesplease authored Mar 3, 2018
    Copy the full SHA
    0ecefd5 View commit details

Commits on Mar 16, 2018

  1. Copy the full SHA
    13c57a9 View commit details
  2. Merge pull request #141 from jamesplease/update-examples

    Update examples to always check for data
    jamesplease authored Mar 16, 2018
    Copy the full SHA
    042a79a View commit details

Commits on Apr 20, 2018

  1. Copy the full SHA
    1ecf69f View commit details
Showing with 2,741 additions and 761 deletions.
  1. +24 −8 .babelrc
  2. +0 −39 .codeclimate.yml
  3. +7 −3 .eslintrc
  4. +2 −1 .prettierrc
  5. +2 −2 .travis.yml
  6. +94 −8 CHANGELOG.md
  7. +210 −146 README.md
  8. +16 −0 ROADMAP.md
  9. +33 −28 docs/FAQ.md
  10. +63 −8 docs/examples.md
  11. +5 −6 docs/guides/INDEX.md
  12. +12 −10 docs/guides/aborting.md
  13. +44 −27 docs/guides/best-practices.md
  14. +22 −17 docs/guides/differences-with-apollo.md
  15. +4 −4 docs/guides/differences-with-fetch.md
  16. +61 −0 docs/guides/integration-with-other-technologies.md
  17. +0 −29 docs/guides/integration-with-technologies.md
  18. +3 −3 docs/guides/request-deduplication.md
  19. +8 −8 docs/guides/request-keys.md
  20. +46 −9 docs/guides/response-caching.md
  21. +25 −9 docs/guides/using-the-lazy-prop.md
  22. +0 −142 docs/guides/why-jsx.md
  23. +21 −0 examples/fetch-components/.gitignore
  24. +35 −0 examples/fetch-components/README.md
  25. +18 −0 examples/fetch-components/package.json
  26. BIN examples/fetch-components/public/favicon.ico
  27. +40 −0 examples/fetch-components/public/index.html
  28. +15 −0 examples/fetch-components/public/manifest.json
  29. +62 −0 examples/fetch-components/src/App.js
  30. +41 −0 examples/fetch-components/src/fetch-components/posts.js
  31. +5 −0 examples/fetch-components/src/index.js
  32. +1 −1 examples/lazy-read/package.json
  33. +2 −3 examples/lazy-read/src/App.js
  34. +2 −2 examples/multiple-requests/package.json
  35. +1 −1 examples/multiple-requests/src/App.js
  36. +21 −0 examples/request-deduplication/.gitignore
  37. +35 −0 examples/request-deduplication/README.md
  38. +17 −0 examples/request-deduplication/package.json
  39. BIN examples/request-deduplication/public/favicon.ico
  40. +40 −0 examples/request-deduplication/public/index.html
  41. +15 −0 examples/request-deduplication/public/manifest.json
  42. +33 −0 examples/request-deduplication/src/App.js
  43. +5 −0 examples/request-deduplication/src/index.js
  44. +21 −0 examples/response-caching/.gitignore
  45. +35 −0 examples/response-caching/README.md
  46. +17 −0 examples/response-caching/package.json
  47. BIN examples/response-caching/public/favicon.ico
  48. +40 −0 examples/response-caching/public/index.html
  49. +15 −0 examples/response-caching/public/manifest.json
  50. +49 −0 examples/response-caching/src/App.js
  51. +5 −0 examples/response-caching/src/index.js
  52. +1 −1 examples/simple-read/package.json
  53. +2 −3 examples/simple-read/src/App.js
  54. +1 −1 examples/updating-a-resource/package.json
  55. +10 −5 examples/updating-a-resource/src/App.js
  56. +2 −1 jest.config.js
  57. +9 −6 package.json
  58. +8 −9 rollup.config.js
  59. +200 −102 src/fetch.js
  60. +2 −2 src/index.js
  61. +17 −0 test/.eslintrc
  62. +498 −0 test/do-fetch.test.js
  63. +310 −115 test/index.test.js
  64. +16 −2 test/responses.js
  65. +319 −0 test/same-component.test.js
  66. +74 −0 test/setup.js
32 changes: 24 additions & 8 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
{
"env": {
"build": {
"presets": [["env", { "modules": false }], "stage-3", "react"],
"presets": [
["env", {
"modules": false
}], "stage-3", "react"
],
"plugins": ["external-helpers", "transform-class-properties"]
},
"buildProd": {
"presets": [["env", { "modules": false }], "stage-3", "react"],
"presets": [
["env", {
"modules": false
}], "stage-3", "react"
],
"plugins": [
"external-helpers",
"transform-class-properties",
[
"transform-class-properties", [
"transform-react-remove-prop-types",
{ "mode": "remove", "removeImport": true }
{
"mode": "remove",
"removeImport": true
}
]
]
},
"es": {
"presets": [["env", { "modules": false }], "stage-3", "react"],
"presets": [
["env", {
"modules": false
}], "stage-3", "react"
],
"plugins": ["transform-class-properties"]
},
"commonjs": {
"plugins": [
["transform-es2015-modules-commonjs", { "loose": true }],
["transform-es2015-modules-commonjs", {
"loose": true
}],
"transform-class-properties"
],
"presets": ["stage-3", "react"]
@@ -31,4 +47,4 @@
"plugins": ["transform-class-properties"]
}
}
}
}
39 changes: 0 additions & 39 deletions .codeclimate.yml

This file was deleted.

10 changes: 7 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -9,13 +9,17 @@
}
},
"rules": {
"no-unused-vars": "error"
"no-unused-vars": "error",
"no-use-before-define": "error",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error"
},
"env": {
"browser": true,
"node": true
},
"globals": {
"Promise": true
}
}
},
"plugins": ["react"]
}
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"singleQuote": true,
"jsxBracketSameLine": true
"jsxBracketSameLine": true,
"trailingComma": "all"
}
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -5,5 +5,5 @@ sudo: false
notifications:
email: false
after_success:
- npm install -g codeclimate-test-reporter
- codeclimate-test-reporter < coverage/lcov.info
# Upload to coveralls, but don't _fail_ if coveralls is down.
- cat coverage/lcov.info | node_modules/.bin/coveralls || echo "Coveralls upload failed"
102 changes: 94 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,122 @@
# Changelog

### v3.2.0 (2021/1/11)

- React 17 is now included in peer dependencies.

### v3.1.2 (2018/8/2)

**Bug Fixes**

- Fixes a bug that can occur in React Native environments

### v3.1.1 (2018/7/10)

**Bug Fixes**

- A race condition has been fixed.

### v3.1.0 (2018/7/10)

**New Features**

- `doFetch` now returns a Promise that _always_ resolves. The value that it resolves to is
the same object that is passed to `afterFetch`. Note that `afterFetch` is only called when a
network request has actually been performed, whereas `doFetch` resolves even when the cache is hit.

### v3.0.1 (2018/4/24)

**Bug Fixes**

- Fixes a bug where `isLazy` would sometimes be computed using previous
props rather than the current props.

### v3.0.0 (2018/4/24)

> 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 to `null`. 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
the `responseType` that you set, then `data` will be set to `null`.

### v2.0.4 (2018/4/20)

**Bug Fixes**

- Fixes a bug where there could be a cache mismatch when re-rendering the same component
that has a fetch policy configured.

### v2.0.3 (2018/3/2)

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

### v2.0.2 (2018/2/21)

**Bug Fixes**

- Fixes a bug where an Uncaught ReferenceError could be thrown

### v2.0.1 (2018/2/17)

**Bug Fixes**

- This fixes a problem where the default `fetchPolicy` would be `"cache-first"` for "write" requests.

### v2.0.0 (2018/2/17)

**Breaking**

- `transformResponse` has been renamed to be `transformData`
- `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).

### v1.1.0 (2018/2/7)

**New Features**

* `responseType` can now be specified as a function. It receives the `response`
- `responseType` can now be specified as a function. It receives the `response`
as the first argument.
* Adds a `requestKey` prop.
* When the request is "faux-aborted," the error will have a `name` equal to `AbortError`.
- Adds a `requestKey` prop.
- When the request is "faux-aborted," the error will have a `name` equal to `AbortError`.
This matches the name of the native error, allowing you to write future-proof code that
handles aborted requests.

### v1.0.0 (2018/2/4)

**Breaking**

* The `responseType` will now be set to `"text"` anytime a response returns
- 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.
- The `responseType` is no longer used when creating the request key.

### v0.3.0 (2018/2/4)

**Changes**

* `fetch-dedupe` has been abstracted into a separate library. This
- `fetch-dedupe` has been abstracted into a separate library. This
does not change the public API of this library.

### v0.2.0 (2018/2/1)

**New Features**

* The render prop will now be passed the `requestKey`.
- The render prop will now be passed the `requestKey`.

### v0.1.0 (2018/2/1)

@@ -39,4 +125,4 @@ named `render`. Accordingly, this library has been updated to use `children` as

**Breaking**

* `<Fetch/>` now uses `children` as the render prop, rather than `render`.
- `<Fetch/>` now uses `children` as the render prop, rather than `render`.
Loading