async-fetch 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -36,7 +36,7 @@ const App = () => {
36
36
  : data
37
37
  ? JSON.stringify(data)
38
38
  : error
39
- ? "Error: " + error.toString()
39
+ ? JSON.stringify(error)
40
40
  : ""}
41
41
  </React.Fragment>
42
42
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "async-fetch",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Use fetch asynchronously for requests within React components.",
5
5
  "main": "useAsyncFetch.js",
6
6
  "scripts": {
package/useAsyncFetch.js CHANGED
@@ -17,6 +17,7 @@ function useAsyncFetch(props, props2) {
17
17
  deps = [],
18
18
  ignore,
19
19
  poll,
20
+ ignoreCleanup,
20
21
  ...props3
21
22
  } = props instanceof Object ? props : {};
22
23
 
@@ -102,10 +103,12 @@ function useAsyncFetch(props, props2) {
102
103
  }, poll);
103
104
 
104
105
  useEffect(() => {
105
- return () => {
106
- setUnmounted(true);
107
- cancelActiveRequest();
108
- };
106
+ if (!ignoreCleanup) {
107
+ return () => {
108
+ setUnmounted(true);
109
+ cancelActiveRequest();
110
+ };
111
+ }
109
112
  }, []);
110
113
 
111
114
  return {