Comparing version 0.2.0 to 0.2.1
@@ -124,6 +124,6 @@ "use strict"; | ||
} | ||
// Cancel any running request when unmounting to avoid updating state after component has unmounted | ||
// This can happen if a request's promise resolves after component unmounts | ||
return request.abort; | ||
}, dependencies); | ||
// Cancel any running request when unmounting to avoid updating state after component has unmounted | ||
// This can happen if a request's promise resolves after component unmounts | ||
react_1.useEffect(() => request.abort, []); | ||
return Object.assign([request, makeResponseProxy(res), loading, error], Object.assign({ request, response: makeResponseProxy(res) }, request)); | ||
@@ -130,0 +130,0 @@ } |
{ | ||
"name": "use-http", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"homepage": "http://use-http.com", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -727,2 +727,3 @@ <a href="http://use-http.com"> | ||
- [ ] tests to make sure `response.formData()` and some of the other http `response methods` work properly | ||
- [ ] aborts fetch on unmount | ||
- [ ] take a look at how [react-apollo-hooks](https://github.com/trojanowski/react-apollo-hooks) work. Maybe ad `useSubscription` and `const request = useFetch(); request.subscribe()` or something along those lines | ||
@@ -729,0 +730,0 @@ - [ ] make this a github package |
Sorry, the diff of this file is not supported yet
87568
897