Skip to content

Commit

Permalink
fix: remove whatwg-fetch polyfill, due problem in React Native
Browse files Browse the repository at this point in the history
  • Loading branch information
nodkz committed Jun 21, 2016
1 parent a593d75 commit 5f5c770
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
## master

## 1.2.0 (June 21, 2016)
* fix: remove `whatwg-fetch` polyfill, due problem in React Native ([issue #8](https://github.com/nodkz/react-relay-network-layer/issues/8)).

If your client does not have `fetch` global method, you should include polyfill explicitly in you code:
```js
import 'whatwg-fetch'; // for old browsers
or
import 'node-fetch'; // for old node versions
or
import 'fetch-everywhere'; // fresh isomorphic fetch polyfill, that supports all clients (not tested ;)
```
Thanks to @roman01la and @edvinerikson.

## 1.1.4 (June 15, 2016)
* feat: add `allowEmptyToken` option for `authMiddleware` to allow made a request without Authorization header if token is empty

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ ReactRelayNetworkLayer
The `ReactRelayNetworkLayer` is a [Relay Network Layer](https://facebook.github.io/relay/docs/guides-network-layer.html)
with query batching and middleware support.

Main purpose to use this NetworkLayer:
This NetworkLayer solves following problems:
- If your app is making enough individual queries to be a performance problem on first page load
- If your app should manipulate request on the fly - log them, change or made some fallbacks if request fails
- If your app should manipulate request/responce on the fly - change auth headers, request url or made some fallbacks if request fails

Can be used in browser, react-native or node server for rendering. Under the hood this module uses global `fetch` method. So if your client is too old, please import explicitly proper polyfill to your code (eg. `whatwg-fetch`, `node-fetch` or `fetch-everywhere`).

Available middlewares:
- **url** - for manipulating fetch `url` on fly via thunk. Options:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-relay-network-layer",
"version": "1.1.4",
"version": "1.2.0",
"description": "Network Layer for React Relay and Express (Batch Queries, AuthToken, Logging, Retry)",
"files": [
"es",
Expand Down Expand Up @@ -35,9 +35,9 @@
},
"homepage": "https://github.com/nodkz/react-relay-network-layer#readme",
"dependencies": {
"babel-runtime": "^6.6.1"
},
"peerDependencies": {
"babel-runtime": "^6.6.1",
"react-relay": ">=0.7.0"
},
"devDependencies": {
Expand Down
2 changes: 0 additions & 2 deletions src/fetchWrapper.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable no-use-before-define, no-else-return, prefer-const, no-param-reassign */

import 'whatwg-fetch';

export default function fetchWrapper(reqFromRelay, middlewares) {
const fetchAfterAllWrappers = (req) => {
let { url, ...opts } = req;
Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ export {
deferMiddleware,
graphqlBatchHTTPWrapper,
};

0 comments on commit 5f5c770

Please sign in to comment.